MySQL5.7密码正确却无法本地登录,ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
报错如下:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
解决方法:
1,vim /etc/my.cnf,在[mysql]下面加上skip-grant-tables,重启mysqld,并用空密码进入,mysql -uroot -p 回车两次
2,alter user ‘root’@‘localhost’ identified by ‘密码’;
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
3,需要刷新配置,输入flush privileges;然后可以修改密码了
4,set password for root@localhost=‘密码’;

浙公网安备 33010602011771号