Error 1045(28000) Access Denied for user 'root'@'localhost'
1.修改my.ini配置文件,找到[mysqld]一行,在下面添加skip-grant-tables后保存,重启mysql服务。
2.然后执行 mysql -u root mysql
mysql>update user set password=password('newpassword') where user='root';
mysql>Flush privileges;
其中newpassword为root的新密码。
3.将刚才my.ini配置文件添加的那一行删掉,重新启动mysql即可
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30046312/viewspace-2142441/
,如需转载,请注明出处,否则将追究法律责任。