When connecting to MySQL: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) - solution
I have been using oracle and mysql for work before, but today I use Navicat to connect and find that ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) is reported. The reason is that the password is forgotten and not lost. Yes, so I googled it, it was all messy, the process was cumbersome, and it was not easy to use, so I studied it for one night, it was convenient, fast and easy to use, and completely solved the trouble of forgetting the mysql password! ! Without further ado, let's get started!
1. Close the mysql service
Open cmd as administrator,If you find that the command does not exist, you can cd to the bin directory under the mysql installation directory to operate
2. Skip permission verification
mysqld --console --skip-grant-tables --shared-memory
3. Open another cmd window as an administrator and enter mysql directly (just don't close)
4. Change the password
alter user root@localhost identified by '666';
Damn, I found an error, don't panic, the key is here! !
5. Refresh mysql permissions and execute the command again
flush privileges;
alter user root@localhost identified by '666';
6. Close the window that was opened for the first time, then quit
7. Restart the mysql service and log in to test
Here we first enter a wrong password to prevent logging in without a password
The connection is successful, and you can happily connect to Navicat! !
Reference document: https://jingyan.baidu.com/article/3ea51489e6cfbe52e61bba25.html