Fixing MySQL 1045 Error: Access Denied

July 5, 2019
Author
Carlos Tutte
Share this Post:

MariaDB no longer meeting your needs?

Migrate to Percona software for MySQL – an open source, production-ready, and enterprise-grade MySQL alternative.

Learn More

MySQL 1045 error Access Denied
During support work, one of the most common issues we see is: “I try to connect to MySQL and get a 1045 error,” often followed by “but I’m sure my user and password are correct.” This post outlines other common causes.

MySQL 1045 Error: Common Causes

1) Connecting to the wrong host

If no host is specified, MySQL connects to localhost by default.

Fix:

2) User does not exist

Fix: Check and create user if needed:

3) Host not allowed for user

Check client IP:

Fix:

4) Incorrect password

Fix: Reset password:

5) Special characters interpreted by Bash

Fix:

6) SSL required but not used

Fix:

More info:

7) PAM backend issues

Fix: Verify system user:

Reset password:

Emergency Access Recovery

  1. Stop MySQL
  2. Add skip-grant-tables to my.cnf
  3. Start MySQL
  4. Login as root
  5. Run FLUSH PRIVILEGES;
  6. Reset password
  7. Remove skip-grant-tables
  8. Restart MySQL

You should now be able to log in normally.

Learn more about Percona Server for MySQL

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved