在centos中安裝了mysql以後解決不知道隨機的密碼的問題

http://blog.csdn.net/qq_26941173/article/details/51548947mysql

1.修改配置文件my.cfgsql

[root@localhost ~]# vi /etc/my.cnf 找到mysqld在以後添加 skip-grant-tables 保存退出數據庫

2. 重啓mysql服務 service mysqld restartui

直接登錄mysql而不須要密碼 mysql -u root (直接點擊回車).net

4 在mysql中輸入update mysql.user set password=password('root') where user='root'; (此時提示ERROR 1054 (42S22): Unknown column 'password' in 'field list')rest

5.(這是怎麼回事?)原來是mysql數據庫下已經沒有password這個字段了,password字段改爲了authentication_string update mysql.user set authentication_string=password('123456') where user='root' ;blog

執行flush privilegesip

退出mysql ,到my.cgf中把開始添加的skip-grant-tables去掉rem

重啓mysql服務大功告成!可是事實並不是如此!get

當你登錄mysql以後你會發現,當你執行命令時會出現 ERROR 1820 (HY000): You must reset your password using ALTER USER statement;

當你執行了SET PASSWORD = PASSWORD('123456'); 出現:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements 10. 你須要執行兩個參數來把mysql默認的密碼強度的取消了才行 set global validate_password_policy=0; set global validate_password_mixed_case_count=2; 11 這是你在執行 SET PASSWORD = PASSWORD('123456');

相關文章
相關標籤/搜索