centos7安装mysql5.7的终极解决方案

在centos7中安装最新版本mysql5.7.10可能会出现各种各样的问题,不管出现什么问题,先仔细阅读下面,或许对你有帮助!

1.systemctl stop mysqld.service 关闭mysql服务
2.vi /etc/my.cnf 在mysqld下面添加 skip-grant-tables,重启mysql服务systemctl start mysqld.service
3.登录mysql,mysql -u root 不用密码直接回车
4.输入 update mysql.user set authentication_string=password('密码') where User='root' and Host='localhost';
5.成功后输入 flush privileges;
6.exit退出mysql
7.vi /etc/my.cnf 把 skip-grant-tables 一句删除保存退出重启mysql服务
8.重新登录mysql,mysql -u root -p回车 输入你刚才填写的密码
9.登录成功后你的操作可能会出现如下两句
Your password does not satisfy the current policy requirements
You must reset your password using ALTER USER statement before executing this statement.
10.不管你如何设置修改密码都不行,原因是mysql5.7.10对密码进行了验证,不要管怎么验证的
11.exit退出mysql在/etc/my.cnf中的mysqld下面添加一句 validate_password=OFF 保存退出,意思是取消验证
12.重启mysqld.service服务,登录mysql
13.进入mysql后填写set password = password('你的密码');
14.这次就可以设置成功!至此mysql完全安装成功!

原文地址:https://www.cnblogs.com/liuruowang/p/5063810.html