1044ERRORTier 1 — Safe✅ HIGH confidenceAccess denied for user to database
What this means
Error 1044 (SQLSTATE 42000) is returned when a user attempts to perform an operation on a database for which they have not been granted the required privilege. Unlike error 1045 which occurs at authentication, 1044 occurs after successful login when a specific database-level action is denied.
Why it happens
- 1The user account was created but no GRANT was issued for the target database
- 2The GRANT was issued on the wrong database name or with incorrect scope
- 3The user is connecting to a replica or a different server instance where grants have not been replicated
How to reproduce
A user with no database-level privileges attempts to USE a database.
-- Run as a user without privileges on myapp_db
USE myapp_db;Fix 1: Grant the required privileges
When the user legitimately needs access to the database.
-- Run as root or a privileged user
GRANT SELECT, INSERT, UPDATE, DELETE ON myapp_db.* TO 'appuser'@'localhost';
FLUSH PRIVILEGES;Why this works
GRANT issues the named privileges on the specified objects to the user. FLUSH PRIVILEGES reloads the in-memory privilege tables from the grant tables, though in modern MariaDB versions explicit GRANT statements take effect immediately without FLUSH.
What not to do
Grant GRANT ALL PRIVILEGES ON *.* to silence the error
Why it's wrong: This gives the user superuser-equivalent access to every database on the server, violating the principle of least privilege.
Version notes
MariaDB 10.4+Password and account management changes mean some legacy grant syntax may behave differently. Use CREATE USER + GRANT in two steps.Sources
📚 Official docs: https://mariadb.com/kb/en/grant/
🔧 Source ref: MariaDB Server error code 1044 / ER_DBACCESS_DENIED_ERROR
📖 Further reading: MariaDB privilege system overview
Confidence assessment
✅ HIGH confidence
Stable and well-documented across all MariaDB and MySQL versions.
See also
🔗 Related errors
📄 Reference pages