1、下载对应系统版本的rpm包
MySQL :: Download MySQL Yum Repository
2、将mysql80-community-release-el7-3.noarch.rpm上传至/usr/files
3、安装rpm包:
sudo yum install mysql80-community-release-el7-3.noarch.rpm
4、安装mysql:
sudo yum install mysql-community-server
5、启动服务:
systemctl start mysqld
6、检查服务状态:
systemctl status mysqld
7、查看默认密码:
sudo grep 'temporary password' /var/log/mysqld.log
8、root账号登陆:
mysql -uroot -p
9、输入7中的密码登录
10、修改登陆密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY '新的密码';
11、退出:
quit
12、使用新密码登录mysql
mysql官方教程:
MySQL :: MySQL 8.0 Reference Manual :: 2.5.1 Installing MySQL on Linux Using the MySQL Yum Repository