在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完全安裝成功!
