• mysql8离线安装


    //下载mysql离线安装包

    下载地址:https://dev.mysql.com/downloads/mysql/

    选择如下:

    【Red Hat Enterprise Linux 7 / Oracle Linux】

    【Red Hat Enterprise Linux 7 / Oracle Linux 7 (x86, 64-bit)】

    //上传tar包至服务器,删除原有的mariadb

    先查看一下是否已经安装了,命令:rpm -qa|grep mariadb

    删除mariadb,命令:rpm -e --nodeps mariadb-libs

    //解压缩mysql离线安装包

    cd /data/user/scm/mysqlApp

    tar -xvf /data/user/scm/mysqlApp/mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar

    解压缩之后,包含以下rpm包

    //必须安装

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-common-8.0.28-1.el7.x86_64.rpm 成功

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-client-plugins-8.0.28-1.el7.x86_64.rpm 成功

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-libs-8.0.28-1.el7.x86_64.rpm 成功

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-client-8.0.28-1.el7.x86_64.rpm 成功

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-icu-data-files-8.0.28-1.el7.x86_64.rpm 成功

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-server-8.0.28-1.el7.x86_64.rpm 成功

    //非必要安装

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-libs-compat-8.0.28-1.el7.x86_64.rpm 成功

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-embedded-compat-8.0.28-1.el7.x86_64.rpm 成功

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-devel-8.0.28-1.el7.x86_64.rpm 失败,解决:yum install openssl-devel.x86_64 openssl.x86_64 -y

    rpm -ivh /data/user/scm/mysqlApp/mysql-community-test-8.0.28-1.el7.x86_64.rpm 失败

    解决:yum install perl.x86_64 perl-devel.x86_64 -y

    yum install perl-JSON.noarch -y

    yum -y install autoconf

    //检查是否开机启动

    systemctl list-unit-files|grep mysqld

    //显示以下为开机启动

    mysqld.service enabled

    mysqld@.service disabled

    //如果没有设置为开机启动则执行

    systemctl enable mysqld.service

    //修改数据库存储路径

    vim /etc/my.cnf

    datadir=/data/user/scm/mysql(制定为新的数据存放目录,开启服务会自动创建该目录)

    //设置默认编码为 utf8,修改 /etc/my.cnf 配置文件,在相关节点(没有则自行添加,mysqld是已有节点)下添加编码配置,如下:

    [mysqld]

    character-set-server=utf8

    [client]

    default-character-set=utf8

    [mysql]

    default-character-set=utf8

    //启动mysql服务

    systemctl start mysqld

    systemctl status mysqld

    //查看MySQL初始默认密码

    grep 'temporary password' /var/log/mysqld.log

    //通过初始密码登录

    mysql -u root -p

    //修改新密码

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';

    //开启MySQL远程连接

    mysql> use mysql;

    #修改root账户权限

    mysql> update user set host = '%' where user = 'root';

    #刷新权限

    mysql> flush privileges;

    #查看默认编码

    mysql> show variables like 'character%';

    //此时mysql已经启动成功,可以通过navicat等工具连接,navicat版本12.1以下的由于驱动未更新,会报错(Authentication plugin ' caching _ sha 2 _ password cannot be loaded : The speaified module could not be found)

    需要修改mysql的加密规则,mysql8 之前的版本中加密规则是mysql_native_password,而在mysql8之后,加密规则是caching_sha2_password。解决问题方法有两种:方法1.升级navicat驱动;方法2.把mysql用户登录密码加密规则还原成mysql_native_password.。此处使用的是方法2

    mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码'; 或者 mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';

    mysql> flush privileges;

    //如果报错ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost'

    https://blog.csdn.net/q258523454/article/details/84555847

  • 相关阅读:
    PyCLIPS的安装
    Dockerfile中安装crontab
    自动化测试如何实施落地?详细教程来了
    OpenCV-滤波矩阵(java版)
    【类型转换】使用c#实现简易的类型转换(Emit,Expression,反射)
    ESP32学习记录 PICO DK 踩坑记录
    巧用Visual Studio中的数据断点去排查C++内存越界问题
    Vector Search和专用Search Nodes:现已正式发布
    问题一:idea提示java: -source 1.5 中不支持switch中用字符串
    大数据学习技术栈及书籍推荐
  • 原文地址:https://blog.csdn.net/qq_40308101/article/details/125498659