废话不多说,直接开始
1. 下载mysql源安装包命令:wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
2. yum localinstall mysql80-community-release-el7-1.noarch.rpm
3. 检测mysql是否安装完成: yum repolist enabled | grep "mysql.*-community.*"
4. 安装mysql: yum install mysql-community-server
5. 设置开启启动mysql服务:systemctl enable mysqld
6. 查看安装的mysql版本:rpm -aq | grep -i mysql
7. 启动MySQL服务:systemctl start mysqld
8. 查看MySQL初始密码:grep 'A temporary password' /var/log/mysqld.log
9. 使用已经获得到的临时密码登陆mysql: mysql -u root -p
10. 修改密码认证强度:set global validate_password.policy=0;
11. 修改mysql密码: ALTER USER "root"@"localhost" IDENTIFIED BY '你的新密码'; 需要有引号!
安装完毕 :)
其他命令: service mysqld start | service mysqld stop | service mysqld restart