1、主要参考:centos8安装mysql8.0(一次成功)
https://blog.csdn.net/MouKing/article/details/123141453
新安装,从第二步的第3点开始。
备注:
* 如果是在CentOS7上安装,下载安装包应该是el7,不是el8。即mysql-8.0.28-1.el8.x86_64.rpm-bundle.tar替换成mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar
* 下载地址替换成清华镜像:
wget https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-8.0/mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar
"https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads/MySQL-8.0"下有各种版本的安装包
2、次要参考:(必要时)
Centos7环境下安装Mysql8详细教程(超详细,亲测百分百成功)
https://blog.csdn.net/qq_41389482/article/details/109711389?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2-109711389-blog-124353176.pc_relevant_multi_platform_featuressortv2removedup&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2-109711389-blog-124353176.pc_relevant_multi_platform_featuressortv2removedup&utm_relevant_index=4
3、关闭centos防火墙,或增加3306端口,才能从主机访问:
* 停止firewall:systemctl stop firewalld.service
* 禁止firewall开机启动:systemctl disable firewalld.service
4、主机访问不被允许的解决方法:
现象:Host is not allowed to connect to this MySQL server
方法:
1)在装有MySQL的机器上登录MySQL mysql -u root -p密码
2)执行use mysql;
3)执行update user set host = ‘%’ where user = ‘root’;
如果报错,将' '改成" ":update user set host = "%" where user = "root";
4)执行FLUSH PRIVILEGES;