部署环境:
安装版本red hat Cent 7.0
MYSQL 版本 8.0.2.0
成功部署完毕后出现故障情况:
1. 正常启动MYSQL服务后,敲Linux中root账户和密码进入不去。
2. 从/etc/my.cnf 配置文件中加入skip-grant-table后正常登陆,但是不能创建用户等多操作
总结来说:
想进去mysql后不能操作多指令,操作多指令又不能进去mysql,死循环
挖坑环节:
网上找了很多办法,首先加入skip-grant-table.后进去刷新权限表,重启服务,不用密码的root进去,在改root密码后,重新刷新权限表。方法试了很多个都不对。修改root环节始终不对。
文章https://www.cnblogs.com/jjg0519/p/9034713.html
给了我提醒,是不是mysql8.0以上的版本密码策略和更改语法不对了。
重新操作一遍:
#vim /etc/my.cnf
【mysql】
添加skip-grant-table
#systemctl stop mysqld.service
#systemctl start mysqld.service
#mysql –u root
[敲回车进入]
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> alter user 'root'@'localhost'IDENTIFIED BY 'MyNewPass';
ERROR 1819 (HY000): Your password does notsatisfy the current policy requirements
mysql> alter user 'root'@'localhost'IDENTIFIED BY 'MyNewPass@123';
ERROR 1396 (HY000): Operation ALTER USERfailed for 'root'@'localhost'
mysql> alter user'root'@'%' IDENTIFIED BY 'MyNewPass@123';
【mysql8.0以上密码策略限制必须要大小写加数字特殊符号,我之前用mysqladmin,set,update,参考修改root密码的前人:http://www.cnblogs.com/liufei88866/p/5619215.html】
Query OK, 0 rows affected (0.05 sec)
退出,把Skip-grant-table语句删除,重新启动数据库
[root@localhost ~]# vim /etc/my.cnf【删除省略】
[root@localhost ~]# systemctl stopmysqld.service
[root@localhost ~]# systemctl startmysqld.service
[root@localhost ~]# mysql -uroot –p
mysql> CREATE USER dbadmin@localhost
-> IDENTIFIED BY 'pwd123';
ERROR 1819 (HY000): Your password does notsatisfy the current policy requirements
mysql> CREATE USER dbadmin@localhost
-> IDENTIFIED BY 'Pwd123';
ERROR 1819 (HY000): Your password does notsatisfy the current policy requirements
mysql> CREATE USER dbadmin@localhost
-> IDENTIFIED BY 'Pwd@123';
ERROR 1819 (HY000): Your password does notsatisfy the current policy requirements
mysql> CREATE USER dbadmin@localhost
-> IDENTIFIED BY 'MyNewPass@123';
Query OK, 0 rows affected (0.10 sec)
【可以正常创建用户,密码安全性还是要求着设置复杂度要高一些】
感谢网友帮助,希望能帮到IT事业上面挖坑的人。