Home > Database > Mysql Tutorial > body text

How to solve the 1045 error when Navicat connects to MySQL

WBOY
Release: 2023-06-02 23:13:10
forward
10657 people have browsed it

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!