Knowledgebase

When connecting to MySQL I get an Access Denied error Print

  • 0

When connecting to MySQL I get an Access Denied error

An Access Denied error occurs when:

  • You input the incorrect username, password, or database name in the connection string.
  • The user does not have the proper privileges to connect to the database.

Furthermore, access denied errors can look different depending on the root cause.

For instance, this error means that you’re using the wrong password:

ERROR 1045 (28000): Access denied for user 'sammy'@'203.0.113.0' (using password: YES)

This access denied error means the connection string didn’t contain the -p flag but a password is required:

ERROR 1045 (28000): Access denied for user 'sammy'@'203.0.113.0'' (using password: NO)

This access denied error means the user does not have privileges on the database specified in the connection string:

ERROR 1044 (42000): Access denied for user 'sammy'@'%' to database 'defaultdb'

If you are getting this error:

  • Ensure you have the correct username, password, and database name in your connection string.
  • Ensure the user has the correct privileges on the database you want to connect to.

Was this answer helpful?
Back

Powered by WHMCompleteSolution