首先my.ini
添加
#跳过密码
skip-grant-tables
重启mysql服务
然后执行修改密码会报错,
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
1290 - The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
先要刷新权限就行了
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)
再注释掉跳过密码
重起mysql服务,输入密码ok