mysql5.6使用老格式密码

文档摘抄

[email protected]> SET SESSION old_passwords=0; Query OK, 0 rows
affected (0.00 sec)

[email protected]> SELECT PASSWORD('123456');
+——————————————-+ | PASSWORD('123456') |
+——————————————-+ | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
+——————————————-+ 1 row in set (0.00 sec)

[email protected]> SET SESSION old_passwords=1; Query OK, 0 rows
affected (0.00 sec)

[email protected]> SELECT PASSWORD('123456');
+——————–+ | PASSWORD('123456') |
+——————–+ | 565491d704013245 |
+——————–+ 1 row in set (0.00 sec

实际操作:
登陆mysql,使用SET SESSION old_passwords=0; //设置老格式密码
SET PASSWORD FOR 'webuser'@'localhost' = PASSWORD('123456') //然后为用户设置密码。

修改配置文件:
[client]
secure_auth = 0
[mysqld]
old_passwords=1

成功登陆!

忘记用户密码时:
[mysqld]
skip-grant-tables

然后不用口令进入mysql修改密码:

UPDATE mysql.user SET Password=PASSWORD(“newpassword”) WHERE User='root' and Host='localhost';

你可能感兴趣的:(mysql5.6使用老格式密码)