- 安装源:
sudo rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
- 确认仓库添加
sudo yum repolist all | grep mysql | grep enabled
- 安装
sudo yum -y install mysql-community-server
启动mysqld
sudo systemctl start mysqld
开机自启
sudo systemctl enable mysqld
查看状态
sudo systemctl status mysqld
获取root临时密码
cat /var/log/mysqld.log | grep -i 'temporary password'
登录mysql
mysql -u root -p
输入获取到的临时密码登录进去
修改root密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Abc123456,';