1、下载mysql8软件库
wget https://repo.mysql.com//mysql80-community-release-el8-3.noarch.rpm
2、安装软件库
rpm -ivh mysql80-community-release-el8-3.noarch.rpm
3、安装mysql
yum install mysql-server
4、启动mysql
systemctl start mysqld
systemctl enable mysqld
5、检查初始密码,目前看到是空密码
cat /var/log/mysql/mysqld.log | grep password
6、修改密码
mysq -uroot -p
直接回车
alter user 'root'@localhost identified by 'newpassword';
7、修改root远程登录权限
use mysql;
update user set host='%' where user='root';
flush privileges;