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

 

posted on 2020-05-16 10:38  张扬个性,敢为天下先  阅读(1161)  评论(0编辑  收藏  举报