Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Three ways to solve Navicat for MySQL 1045 errors

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces three ways to solve Navicat for MySQL 1045 errors, which can be used for reference by interested friends. I hope you will gain a lot after reading this article.

Three ways to solve Navicat for MySQL 1045 errors

Navicat will inevitably encounter a 1045 error when connecting to the MySQL database, mainly because the user name or password entered by the user is denied access. If you do not want to reinstall it, you need to retrieve or reset the password.

Recommended tutorial: video tutorial for getting started with MySQL Database

Navicat for MySQL 1045 error

Problem description:

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

The solution is to reset the root user password. On Windows platform, the steps are as follows:

Method 1:

1. Log in to the system as a system administrator

If the MySQL server is running, stop it.

If you are running as a Windows service, go to Service Manager: start menu-> Control Panel-> Administrative tools-> Service; if the server is not running as a service, you may need to use Task Manager to force it to stop.

Create a text file and put the following commands on a single line:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' MyNewPassword')

Save the file with any name. In this case, the file is C:\ mysql-init.txt.

4. Enter the DOS command prompt: start menu-> run-> cmd

Suppose you have installed MySQL to C:\ mysql. If you installed MySQL to another location, please adjust the following command accordingly.

From the DOS command prompt, execute the command:

C: > C:\ mysql\ bin\ mysqld-nt-init-file=C:\ mysql-init.txt

When the server starts, execute the "- init-file" option to read the contents of the file named by the SQL command from the specified file at startup, and change the root password. When the server starts successfully, you should delete C:\ mysql-init.txt.

Stop the MySQL server and restart it in normal mode.

Method 2:

Directly use the username and password provided in the [client] section of the / etc/mysql/debian.cnf file:

# mysql-udebian-sys-maint-p Enter password: mysql > UPDATE user SET Password=PASSWORD ('newpassword') where USER='root'; mysql > FLUSH PRIVILEGES; mysql > quit * * # mysql-uroot-p Enter password: mysql >

Method 3:

1. The administrator logs in to the system, stops the mysql service or ends the mysqld-nt process

2. Enter the command line and go to the installation directory of mysql. Suppose the installation directory is d:\ mysql\, and CMD enters the command line

3. Run d:\ mysql\ bin\ mysqld-nt-skip-grant-tables to start mysql and turn off the permission check

4. Run d:\ mysql\ bin\ mysqladmin-u root flush-privileges password "newpassword" to reset the root password

5. Restart the mysql service

Thank you for reading this article carefully. I hope the article "three ways to solve Navicat for MySQL 1045 errors" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report