DBAtlas · Database operations atlas

1044: Access denied for user to database

MySQL

What does it mean?

Although the user authenticated correctly, it does not have privileges to operate on the specified database.

Why does it happen?

No GRANT on the database for the user, a wrong database name, the privilege defined for a different host (user@host) or a non-existent database.

How to fix it

View the user's privileges: SHOW GRANTS FOR 'app_user'@'host'. Grant the required privilege: GRANT ALL PRIVILEGES ON mydb.* TO 'app_user'@'host'; (GRANT takes effect immediately, FLUSH PRIVILEGES is not needed). Verify the correct host match and database name. Following the principle of least privilege, grant only the rights that are needed.

Open in DBAtlas →

More from this engine