MySQL password is correct but cannot log in locally -1045 Access denied for user 'root'@'localhost' (using password:YES MySQL password is correct but cannot log in locally The error is as follows: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) Solution: 1. Add the option to skip the password question in the parameters for starting MySQL, as follows: And add skip-grant-tables under [mysql], This is used to skip the password question, but it is not a complete solution. 2. Restart the MySQL service I use Mysql in Linux system, the statement is as follows: Check the port number: Check the status: Restart mysql service Try to connect: Enter the password. You have just set it to skip the password, so you can ignore it. The steps are as follows: [root@localhost ~]# mysql -uroot -p123456 mysql> use mysql Database changed mysql> select user,host,password from user where user='root'; +------+-----------------------+-------------------------------------------+ | user | host | password | +------+-----------------------+-------------------------------------------+ | root | % | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | | root | localhost.localdomain | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | | root | 127.0.0.1 | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | | root | ::1 | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | +------+-----------------------+-------------------------------------------+ 4 rows in set (0.02 sec) 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 Bye OK, exit mysql, restart mysql to solve the problem Compare before and after: [root@localhost ~]# mysql -uroot -p mysql> use mysql; Database changed mysql> select user,host,password from user where user='root'; +------+-----------------------+-------------------------------------------+ | user | host | password | +------+-----------------------+-------------------------------------------+ | root | localhost | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | | root | localhost.localdomain | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | | root | 127.0.0.1 | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | | root | ::1 | *00A51F3F48415C7D4E8908980D443C29C69B60C9 | +------+-----------------------+-------------------------------------------+ 4 rows in set (0.00 sec) mysql> OK! Summarize The above is what I introduced to you. The MySQL password is correct but you cannot log in locally - 1045 Access denied for user ''root''@''localhost'' (using password: YES. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. Thank you very much for your support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Keepalived implements Nginx load balancing and high availability sample code
>>: js method to realize shopping cart calculation
Table of contents Preface vue-cli 2.0 version vue...
Error description When we install Docker Desktop,...
This article example shares the specific code of ...
This article shares the specific code of jQuery t...
In new projects, axios can prevent duplicate subm...
Table of contents introduction 1. MySQL master-sl...
1. Install Apache $ sudo apt update && su...
This article example shares the specific code of ...
LEMP (Linux + Nginx + MySQL + PHP) is basically a...
Table of contents First, configure package.json T...
In the path of using nginx as a reverse proxy tom...
<br />Table is an awkward tag in XHTML, so y...
This article mainly explains how to use clearfix a...
1. Check the kali linux system version Command: c...
Preface Since vue3.0 was officially launched, man...