更新 MySQL 5.7 以后通过以下方法无法在修改root密码;
update mysql.user set password=password('123456') where user='root';
查看下MySQL的官方文档发现版本更新后原来user里的password字段已经变更为authentication_string,所以使用上述语句更新会提示“password 字段不存在;
新的更新方法;
UPDATE mysql. USER SET authentication_string = PASSWORD ('MyNewPass'), password_expired = 'N' WHERE USER = 'root' AND HOST = 'localhost'; FLUSH PRIVILEGES;
参考文档:
https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html