Home  >  Article  >  Database  >  How to solve the 1045 error when Navicat connects to MySQL

How to solve the 1045 error when Navicat connects to MySQL

WBOY
WBOYforward
2023-06-02 23:13:1010674browse

Error message: 1045-Access denied for user 'root' 'localhost' (using password: YES)

navicat encounters a 1045 error when connecting to MySQL data, usually due to input If the user name or password is incorrect and access is denied, you can reset the password of the MySQL database to solve the problem.

The steps in windows are as follows:

1. Find the my.ini file of mysql and add skip-grant-tables under the mysqld keyword, as shown in the figure below Display:

How to solve the 1045 error when Navicat connects to MySQL

The function of this command is to skip the authorization table, that is, you can enter mysql to see all data tables by entering any character account password.

If you forget your account password, you can use the modification command to change the password, but you must shut down MySQL immediately and restart it to avoid potential risks on the server.

2. Restart the MySQL service

3. Enter mysql -u root mysql in the command prompt (cmd)

4. Change the password

Enter in the command prompt (cmd):

update user set password=password("root123") where user="root";

If there is an error "ERROR" 1054 (42S22): Unknown column 'password' in 'field list'"

Then enter: update user set authentication_string=password('root22') where user='root';

Enter exit to exit, then reconnect the data, and the connection will be successful.

Note:

1. If you cannot find the location of the my.ini file, you can open the service manager to find the MySQL service, right-click on Properties, and select "Executable File" You can see the location of my.ini in "Path". If the default installation path is used during installation, it is usually in the "C:\ProgramData\MySQL\MySQL Server 5.7" folder. It should be noted here that the "ProgramData" folder may be hidden.

2. Configure the bin directory under the installation path of mysql into the environment variable, otherwise it will prompt "Command line input mysql -u -root -mysql shows that it is not an internal or external command or a runnable program." ".

The above is the detailed content of How to solve the 1045 error when Navicat connects to MySQL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete