假如你有root用户或者其他超级权限大用户,直接修改mysql数据库的user表。
首先,以命令行进入
mysql -u root -p
然后
use mysql;
再然后
UPDATE user SET password=PASSWORD("your new password") WHERE user='your name';
Mysql 5.7版本存储密码字段不是password
,是authentication_string
,所以语句应该改为
UPDATE user SET authentication_string=PASSWORD("your new password") WHERE user='your name';
刷新权限:
FLUSH PRIVILEGES;
退出
exit;
妥妥的搞定。