ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.html
今天在MySql5.6操做時報錯:You must SET PASSWORD before executing this statement解決方法,須要的朋友能夠參考下mysql
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
很是詭異啊,明明用密碼登錄進去了,怎麼還提示須要密碼。
參考官方的一個文檔,見http://dev.mysql.com/doc/refman/5.6/en/alter-user.html。以下操做後就ok了:
mysql> create database yan1;
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
mysql> SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected (0.03 sec)
mysql> create database yan1;
Query OK, 1 row affected (0.00 sec)
也就是用mysql> SET PASSWORD = PASSWORD('123456');這句話從新設置一次密碼!大爺的,真費勁啊。
這位仁兄也遇到了相同的問題。
最近新裝好的mysql在進入mysql工具時,老是有錯誤提示:
# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
或者
# mysql -u root -p password 'newpassword'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)' sql
MySql5.6操做時報錯:You must SET PASSWORD before executing this statement解決
mysql> SET PASSWORD = PASSWORD('123456');
Query OK, 0 rows affected (0.03 sec)
mysql> create database roger;
Query OK, 1 row affected (0.00 sec)
也就是用mysql> SET PASSWORD = PASSWORD('123456');這句話從新設置一次密碼!
數據庫
若是 MySQL 正在運行,首先殺之: killall -TERM mysqld。 ide
運行mysqld_safe --skip-grant-tables & 工具
若是此時不想被遠程鏈接:mysqld_safe --skip-grant-tables --skip-networking &ui
使用mysql鏈接serverthis
更改密碼: update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';加密
*特別提醒注意的一點是,新版的mysql數據庫下的user表中已經沒有Password字段了server
而是將加密後的用戶密碼存儲於authentication_string字段
mysql> flush privileges;
mysql> quit;
修改完畢。重啓
killall -TERM mysqld。
mysqld_safe &
而後mysql就能夠鏈接了
可是此時操做彷佛功能不徹底,還要alter user...
alter user 'root'@'localhost' identified by '123';
網文說醬紫也能夠:set password for 'root'@'localhost'=password('123');