- 安装mysql5.7 yum 源
yum install http://repo.mysql.com/mysql57-community-release-el7.rpm
- 检索之前安装的mysql
rpm -qa | egrep “mariadb|mysql”
rpm -e mariadb* --nodeps
如有自行删除
- 安装mysql服务
yum install mysql-server -y
- 找mysql初始密码
grep 'root@localhost' /var/log/mysqld.log
- 修改root密码
alter user 'root'@'localhost' identified by "Junjun@2021!"
这里安全策略未做修改,请复杂一些
- 给root赋予远程访问权限
update mysql.user set host = '%' where user = 'root';
flush privileges;
exit ;
到此完成 仅作为笔记使用,如有错误,请略过*