参考:https://blog.csdn.net/qq_32125629/article/details/80660737
1、卸载当前mysql版本
2、在最新下载地址下载mysql8:https://dev.mysql.com/downloads/mysql/
选择 RPM Bundle下载,上传到linux的usr文件夹下
3、解压,按顺序安装
4、开启服务
service mysqld start
5、MySQL的密码初始值不再是空了, 首次登录需要去获取MySQL给的初始值
cat /var/log/mysqld.log
6、登录,修改密码,需要大小写加数字加特殊字符够8位
alter user user() identified by 'xxxxxxxx'
7、 远程连接
vim /var/log/mysqld.log
在最后一行添加
default_authentication_plugin=mysql_native_password
进入mysql设置:
mysql -uroot -p
use mysql;
alter user 'root'@'localhost' identified with mysql_native_password by '123456';
flush privileges;
update user set host='%' where user='root';
flush privileges;
退出MySQL
8、开放Linux的对外访问的端口3306
/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save ---将修改永久保存到防火墙中
大功告成