ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
今天在MySql5.6操作时报错:You must SET PASSWORD before executing this statement解决方法,需要的朋友可以参考下
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
非常诡异啊,明明用密码登陆进去了,怎么还提示需要密码。 参考官方的一个文档,见。如下操作后就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)'
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。
运行mysqld_safe --skip-grant-tables &
如果此时不想被远程连接:mysqld_safe --skip-grant-tables --skip-networking &
使用mysql连接server
更改密码: update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
*特别提醒注意的一点是,新版的mysql数据库下的user表中已经没有Password字段了
而是将加密后的用户密码存储于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');