1. 打开官网MySQL安装文档
2. 根据Linux版本下载yum源
cat /etc/os-release
yum localinstall mysql84-community-release-el7-1.noarch.rpm
3. 查看可安装的MySQL包
yum repolist enabled | grep mysql.*-community
4. 安装MySQL
# EL8 systems 需要先禁止.
yum module disable mysql
yum install mysql-community-server
5. 启动MySQL
systemctl start mysqld
6. 登录MySQL
# 查看生成的随机密码
cat /var/log/mysqld.log |grep password
mysql -uroot -p
7. 初始化操作
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Test@123';
update mysql.user set host='%' WHERE user='root';
FLUSH PRIVILEGES;
问题: Error: 13 (Permission denied)
vim /etc/selinux/config
# 关闭后重启系统
SELINUX=disabled