mysql 重置root密码

myini文件增加命令

(1)在my.ini文件的[mysqld]块下增加“skip_grant_tables”,然后重启mysql服务,再以管理员权限打开cmd执行一些列命令重置密码

 mysql 重置root密码

mysql> use mysql;
Database changed
mysql> update user set authentication_string=password('***') where user='root' and Host='localhost';

Query OK, 1 row affected, 1 warning (0.00 sec)

改完之后 把ini文件的skip那个删掉

登录之后报错

mysql 重置root密码

You must reset your password using ALTER USER statement before executing this statement.

 mysql 重置root密码

通过命令 :


SET PASSWORD = PASSWORD('xxxxx')