MySQL密码正确却无法本地登录-1045 Access denied for user 'root'@'localhost' (using password:YES)

解决方法:
1、在启动mysql的参数中加入跳过密码问题方式,如下:
vim /etc/my.cnf
并在[mysql]下面加上skip-grant-tables,

2: 

[root@localhost ~]# mysql -uroot -p123456
mysql> use mysql
Database changed

mysql> update user set host='localhost' where user='root' and host='%';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)

mysql> quit
原文地址:https://www.cnblogs.com/zgaspnet/p/12899066.html