windows下修改mysql的root密码

前提:知道root用户密码

1、cmd登录mysql

mysql -uroot -p;

2、直接修改user表中存储密码的字段

update mysql.user set authentication_string=password('wlcms12!@') where user='root';

注意:5.7版本已经没有password字段,而是使用authentication_string它来存储加密过的密码;

5.7以前的版本可使用:

update mysql.user set password=password('wlcms12!@') where user='root';

3、刷新数据库对象

flush privileges;

4、quit;或者exit;都行

5、重新登录,测试是否已经修改完成。

原文地址:https://www.cnblogs.com/gygx110/p/13070873.html