Mysql8.0离线安装(centos7)

  1. rpm -qa|grep mariadb 查看是否安装mariadb
  2. 如果存在,用rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64 卸载(软件名从上面查询结果复制)。
  3. tar -xvf mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar 解压MySQL安装包
  4. rpm -ivh mysql-community-common-8.0.16-2.el7.x86_64.rpm 依次安装软件包,检测到依赖缺失,用yum install安装依赖。
  5. rpm -ivh mysql-community-libs-8.0.16-2.el7.x86_64.rpm
  6. rpm -ivh mysql-community-libs-compat-8.0.16-2.el7.x86_64.rpm
  7. rpm -ivh mysql-community-embedded-compat-8.0.16-2.el7.x86_64.rpm
  8. rpm -ivh mysql-community-client-8.0.16-2.el7.x86_64.rpm
  9. rpm -ivh mysql-community-devel-8.0.16-2.el7.x86_64.rpm (需要安装依赖:yum install openssl-devel)
  10. rpm -ivh mysql-community-server-8.0.16-2.el7.x86_64.rpm (需要安装依赖:yum install net-tools、yum install perl)
  11. systemctl start mysqld.service 启动mysql服务 systemctl enable mysqld.service (设置开机启动)
  12. grep 'temporary password' /var/log/mysqld.log 查看初始密码
  13. mysql –uroot –p登录mysql
  14. ALTER USER 'root'@'localhost' IDENTIFIED BY 'pwd'; 修改密码
  15. update user set host='%' where user ='root'; 授权远程登录,flush privileges; 刷新权限。
  16. ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; (去除身份验证,防止maxwell无法连接,可能需要执行两遍)。

    推荐阅读