这篇文章上次修改于 1724 天前,可能其部分内容已经发生变化,如有疑问可询问作者。

在MySQL 5.7 password字段已从mysql.user表中删除,新的字段名是“authenticalion_string”.

选择数据库:use mysql;
更新root的密码:

update user set authentication_string=password('新密码') where user='root' and Host='localhost';

刷新权限:

flush privileges;