1. 利用xshell连接好服务后,输入 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 下载软件安装包文件
2. 输入 yum localinstall mysql57-community-release-el7-8.noarch.rpm 安装文件
3. 输入 yum repolist enabled | grep "mysql.*-community.*" 检查是否安装成功,出现如图表示成功
4. 输入 yum install mysql-community-server 安装服务,过程中会让你确认,一直输入 y 确认即可
5. 输入 systemctl start mysqld 启动数据库
6. 输入 systemctl enable mysqld 后,再输入
systemctl daemon-reload 设置开机启动
7. 输入 grep 'temporary password' /var/log/mysqld.log 得到临时密码,
I?9hwo%fmIDf 就是临时密码
A temporary password is generated for root@localhost: I?9hwo%fmIDf
8. 输入 mysql -uroot -p 后输入密码,就是刚才的临时密码
9. 进入mysql,修改密码:输入 ALTER USER 'root'@'localhost' IDENTIFIED BY 'newPassword!';
密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位,否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误