#
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
#安装MySQL
yum install mysql-server
#开启MySQL
service mysqld start
#进入配置
vi /etc/my.cnf
#配置文件最后一行添加
skip-grant-tables
#重启MySQL
systemctl restart mysqld
#无密码进入
mysql -uroot -p
#选择库
use mysql
#修改密码
alter user 'root'@'localhost' identified by '123456'
#Host设置任意
update user set Host='%' where User='root'
#刷新
flush privileges