Fix MySQL Error 1045 (28000): Access Denied for User 

Summary: The MySQL Error typically occurs when you have to set out access to your MySQL database through WordPress. The request will be denied if the server doesn’t think you are authorized to perform the action. Maybe you are using the wrong password or you have the required permissions. So, there are plenty of ways to fix the MySQL error 1045 (28000). In this blog post, we will talk about the verified solutions to resolve MySQL error 1045. Additionally, we have the MySQL Database Recovery software which is a prominent tool to recover corrupted MySQL databases. Along with this, we take a look at some restrictions for which users want to resolve this error. Let’s get started. Download Now   Purchase Now

What is MySQL Error 1045 (28000)

MySQL is a relational database management system that stores and provides access to data points that are related to one another. MySQL uses Structured Query Language to add, access, and manage content in a database. However, many times MySQL error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) appears.

Reasons for MySQL Error 1045 (28000)

In MySQL, the error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) can appear because of the following reasons:

  1. When the host is not the admin.
  2. It might happen that the user does not exist on the server.
  3. Recheck the Login credentials: username and password.

So, here I will explain how to fix the error by providing a solution to the given problems. After that, I will justify the query using a utility.

Fixing the Error 1045 (28000): Access Denied for User ‘root’@’localhost’ (using password: YES) on Windows

Now, we will look into the problem-solving steps for the reasons stated above. Follow the methods given below:

1. When the Host is Not the Admin

The issue 1045 access denied for user localhost’ (using password: YES) can also occur when a person is trying to log in from another device. Try to log in from the same device in which you were earlier using the MySQL service.

2. The User Does Not Exist on the Server

The user may not exist on the same server that your MySQL is using. This can cause the error: Access denied for user ‘root’@’localhost’ (using password: YES). So, to solve the issue user must be on the MySQL server.

3. Recheck the Login Credentials: Username and Password

While Login to the MySQL server users may encounter the given error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES). This could mean that the password that you entered is wrong, so, to resolve the issue, follow the steps below:

  • Open /etc/mysql/my.cnf path from the SSH Server.
  • Then add the skip-grant-tables [mysqld] section.

Note: There is no other way to log in besides skip-grant tables. So, anyone can log in from anywhere and can do anything on the database. Skip-grant-tables is a dangerous option. So, we will remove this at the end.

  • Restart, MySQL service using the command: service mysql restart

So, now when you log in, ‘skip-grant-tables’ is configured in MySQL.

  • Log in to MySQL using: the MySQL -u root command.
  • Then, flush the privileges by using: mysql> flush privileges;
  • Here you can set a new password using the command: UPDATE user SET

Password=PASSWORD (‘my_password’) where USER=‘root’;


  • After that, remove the skip-grant-tables section from /etc/mysql/my.cnf
  • At last, restart and log in to the MySQL service using the new password.

You can check your error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) is now fixed.

4. Grant Privileges

This error can also occur when there are no global privileges provided. So, to add the privileges use the given command:

GRANT ALL PRIVILEGES ON THE database.* TO ‘user’@‘localhost;’

Now, you can check your status for the error. If the error is still not resolved, then you must use the MySQL Database Recovery tool. In the next section, I will brief you on insights into this utility.

MySQL Database Recovery Utility to Recover MySQL Database

MySQL Database Recovery is a prominent tool to recover corrupted MySQL databases. Using the MySQL Database Recovery software, you can restore all your database objects such as views, tables, triggers, and more. Users can recover data from InnoDB and My ISAM engines with ease. The software maintains data integrity throughout the recovery process of corrupt SQL databases using smart algorithms. MySQL database recovery software can also solve MySQL error 1146 table doesn’t exist.


So, this was the MySQL error 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES). I have provided quick solutions to fix the error. Work becomes hard when such errors appear and cause trouble while Logging. So, follow all the steps to resolve the error. Moreover, mentioned a quick solution to recover MySQL database using (MySQL Database Recovery) tool. It helps to maintain data integrity throughout the recovery process. To recover from such issues in future preferences. The utility will help you to fix MySQL error 1045.

5/5 - (1 vote)

About The Author:

Roshan Fatima is a Technical Writer at Data Conversion Tools. She is a Tech enthusiast, holding over 2 years of experience in Data Recovery Solutions. She loves researching and providing solutions to technical problems and tips and tricks to solve Windows technical issues. In her free time, she likes to read books and novels. Enjoys traveling and exploring new things.

Related Post