1、下载官网rmp包
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
2、yum安装
yum -y install mysql57-community-release-el7-10.noarch.rpm
3、安装mysql服务器
yum -y install mysql-community-server
4、先启动mysql
systemctl start mysqld.service
5、查看配置文件,查到log-error文件, log-error=/var/log/mysqld.log
cat /etc/my.cnf
6、查看log-error文件内容
vi /var/log/mysqld.log
7、查看mysql临时密码
8、登陆mysql
mysql -uroot -p
9、修改密码:
ALTER USER USER() IDENTIFIED BY 'new password';
10、如果出现以下问题:
Your password does not satisfy the current policy requirements
表示你设置的密码不符合mysql密码设置规则 ,则可以进行规则 修改
set global validate_password_policy=0;
设置成功后,再执行修改密码命令(第9步),修改成功后,即完成;