mysql修改密码报错

avatar 2020年3月17日18:05:38 评论 1,206 次浏览

mysql已经安装好了,不过重置密码的时候使用update修改mysql的密码出现了报错,我的mysql是5.7版本的

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password=password("root") where user="root";
ERROR 1054 (42S22): Unknown column 'password' in 'field list'

这里提示,找不到'password',以前版本都是这样修改的,不过5.7版本需要使用'authentication_string'

mysql> update mysql.user set authentication_string=password('root') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

加了'authentication_string'mysql的密码就修改成功了。

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: