1.在mysql的安装目录下找到my.ini配置文件,打开,在如下图所示位置加入skip-grant-tables,保存

2.在mysql安装目录下打开CMD,输入命令mysql -uroot -p后无需输入密码,回车

如果发生如上错误,则在计算机找到服务,关闭并重新打开mysql,则可再次输入上述命令,可正常进入mysql

3.继续输入如下命令更改密码

use mysql;

update user set password=password('12345') where user='root';

如果发生如下错误,为版本问题

更改命令,输入update mysql.user set authentication_string=password('root') where user='root' ;

4.删除或注释掉my.ini文件下的skip-grant-tables语句,重新输入更改后的密码即可正常进入phpAdmin。