Mysql 忘记管理员密码更改

对管理员设置密码

第一种方式:

#mysqladmin -u root password 'new-password';

#mysqladmin -u root -h localhost password 'new-password';

mysql的选项可以不带空格,有时候带空格是错

第二种方式:

set password for root@locahost=PASSWORED('');


第三种方式:

update user set password=password('new-password') where user='root' and host='127.0.0.1';

原文地址:https://www.cnblogs.com/staryea/p/8521720.html