CentOS7.9 使用 Yum 安装 MySQL8.0
1、yum仓库下载MySQL:
yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
2、yum安装MySQL:
yum -y install mysql-community-server --nogpgcheck
3、启动MySQL服务:
systemctl start mysqld
systemctl enable mysqld
4、查看初始密码(如无内容直接跳过):
grep 'temporary password' /var/log/mysqld.log
5、本地MySQL客户端登录:
mysql -uroot -p
6、输入密码为第5步查出的,如果没有,直接回车,然后输入命令
flush privileges
7、修改root登录密码:
use mysq; ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';