系统相关
首页 > 系统相关> > centos7 64位系统 安装MySQL8.0.27教程

centos7 64位系统 安装MySQL8.0.27教程

作者:互联网

登录官网地址(https://downloads.mysql.com/archives/community/)下载8个rpm包:

mysql-community-client-8.0.27-1.el7.x86_64.rpm

mysql-community-client-plugins-8.0.27-1.el7.x86_64.rpm

mysql-community-common-8.0.27-1.el7.x86_64.rpm

mysql-community-devel-8.0.27-1.el7.x86_64.rpm

mysql-community-embedded-compat-8.0.27-1.el7.x86_64.rpm

mysql-community-libs-8.0.27-1.el7.x86_64.rpm

mysql-community-libs-compat-8.0.27-1.el7.x86_64.rpm

mysql-community-server-8.0.27-1.el7.x86_64.rpm

mysql-community-test-8.0.27-1.el7.x86_64.rpm

1、rpm -qa | grep mariadb 首先查询服务器是否安装过mariaDB,如果有则需要先删除,再安装; rpm -e –nodeps mariadb-libs-5.5.89.el7.x86_64 删除mariadb包;

2、开始安装mysql包,有依赖关系,需要从上到下按顺序安装;

rpm -vih mysql-community-common-8.0.27-1.el7.x86_64.rpm

rpm -vih mysql-community-client-plugins-8.0.27-1.el7.x86_64.rpm

rpm -vih mysql-community-libs-8.0.27-1.el7.x86_64.rpm

rpm -vih mysql-community-libs-compat-8.0.27-1.el7.x86_64.rpm

rpm -vih mysql-community-client-8.0.27-1.el7.x86_64.rpm

rpm -vih mysql-community-embedded-compat-8.0.27-1.el7.x86_64.rpm

rpm -vih mysql-community-server-8.0.27-1.el7.x86_64.rpm

3、systemctl start mysqld

执行命令启动mysql服务

4、sudo grep temporary password /var/log/mysqld.log 查看初始密码

5、mysql -uroot -p 输入密码登录mysql

6、ALTER USER root@localhost IDENTIFIED BY 你的密码; 修改你的密码

7、firewall-cmd --zone=public --add-port=3306/tcp –permanent firewall-cmd –reload 开通并重启防火墙

8、开放其他电脑可以进行远程链接链接

  1. use mysql
  2. update user set host=% where user=root;
  3. GRANT ALL PRIVILEGES ON *.* TO root@% WITH GRANT OPTION;
  4. flush privileges;

具体问题整理:

mysql 连接错误 2058 Plugin caching_sha2_password could not be loaded:

由于mysql8.0的方法变了。mysql8.0默认采用caching_sha2_password的加密方式。sqlyog不支持这种加密方式

1、修改密码过期

ALTER USERroot@localhost IDENTIFIED BY root PASSWORD EXPIRE NEVER;

2、重新修改密码

ALTER USERroot@% IDENTIFIED WITH mysql_native_password BY root;

3、刷新权限(不做可能无法生效)##多刷新几次

FLUSH PRIVILEGES;

mysql8 提示 ERROR 1410 (42000): You are not allowed to create a user with GRANT:

1、使用mysql 数据库 mysql > use mysql;

2、特定用户的host 修改 mysql > update user set host=% where user=root;

3、指定用户的授权 mysql > grant all privileges on test.* to root@%

标签:64位系统,centos7.0,centos76,安装MySQL,实用教程,教程
来源: