> 数据库 > MySQL >

Mysql问题 ERROR 1054 (42S22): Unknown column ‘password‘ in ‘field list‘

问题:
在mysql 5.7版本 修改mysql 用户密码:

update mysql.user set password=password('root') where user='root'

提示出错:

ERROR 1054 (42S22): Unknown column 'password' in 'field list'

问题原因:
在mysql5.7及以上数据库下已经没有password这个字段了,password字段改成了authentication_string

update MySQL.user set authentication_string=password('root') where user='root'

其他方式更改密码:

set password for root@localhost = password('123456');
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;

更改密码后记得刷新:

flush privileges;

(责任编辑:IT)