登录官网地址(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、开放其他电脑可以进行远程链接链接
- use mysql
- update user set host=% where user=root;
- GRANT ALL PRIVILEGES ON *.* TO root@% WITH GRANT OPTION;
- 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@%
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/290134.html