High severityauthentication
MySQL Error:
1044
What does this error mean?
MySQL error 1044 fires after a successful login when the authenticated user tries to USE, SELECT from, or write to a database where no matching GRANT exists. The server returns `ERROR 1044 (42000): Access denied for user 'x'@'host' to database 'y'`. In a data-pipeline context this typically surfaces as a failed ADF copy activity, a dbt `run` or `source freshness` error, or a Power BI refresh timeout. The confusing part: the connection itself succeeds (no 1045), so the first instinct is to blame the query — but the root cause is a missing database-level privilege. Check `SHOW GRANTS` for the exact user+host pair your pipeline uses.
Common causes
- 1The user was created with `CREATE USER` but no `GRANT ... ON database.*` was ever issued — only global or table-level grants exist
- 2The GRANT statement targeted a different database name due to a typo, casing mismatch, or schema-name drift between environments (e.g. `analytics_prod` vs `analytics-prod`)
- 3The database was dropped and recreated (or restored from backup) which invalidated the original GRANT — MySQL stores grants by database name, not by internal ID
- 4The user connects from a host that matches a more restrictive grant entry (e.g. `'user'@'10.0.0.%'` has grants, but the pipeline connects from `10.1.0.5` and falls back to `'user'@'%'` which has no database-level privileges)
- 5An IaC or provisioning script (Terraform, Ansible, Helm) created the user but the GRANT step was skipped, failed silently, or ran against the wrong MySQL instance
- 6A DBA revoked privileges during a security audit or credential rotation and forgot to re-grant the required database-level access for service accounts
How to fix it
- 1Step 1: Identify the exact user+host pair your pipeline uses. Check the ADF linked service, dbt `profiles.yml`, or Power BI gateway connection string for the username and source IP.
- 2Step 2: Connect to MySQL as an admin and inspect current grants: `SHOW GRANTS FOR 'etl_user'@'%';` — look for a line containing `GRANT ... ON your_db.*`. If it only shows `GRANT USAGE ON *.*`, the user has zero database-level privileges.
- 3Step 3: Verify the database name matches exactly: `SHOW DATABASES LIKE 'your_db';` — MySQL database names are case-sensitive on Linux. A grant on `Analytics` does not cover `analytics`.
- 4Step 4: Grant the minimum required privileges. For a read-only ETL source: `GRANT SELECT, SHOW VIEW ON your_db.* TO 'etl_user'@'%';` For dbt (needs DDL): `GRANT SELECT, CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, REFERENCES ON your_db.* TO 'dbt_user'@'%';`
- 5Step 5: Apply the changes: `FLUSH PRIVILEGES;` — required if you modified the grant tables directly, good practice after any GRANT statement.
- 6Step 6: Test from the pipeline's network path, not from localhost: `mysql -u etl_user -h 10.0.0.5 -p -e "USE your_db; SELECT 1;"` — confirms both the grant and the host match work.
- 7Step 7: Re-trigger the failed pipeline run. In ADF: re-run the failed activity from the Monitor tab. In dbt: `dbt retry`. In Power BI: trigger a manual dataset refresh from the service.
Example log output
ERROR 1044 (42000): Access denied for user 'etl_user'@'10.0.0.5' to database 'analytics_prod'
2026-05-11 06:15:03 [ERROR] ADF activity 'Copy_MySQL_Orders' failed: ErrorCode=UserErrorDatabaseAccessDenied, Message='Access denied for user etl_user to database analytics_prod'
2026-05-11 06:15:04 [WARN] dbt source freshness check failed for source.mysql_analytics: mysql.connector.errors.ProgrammingError: 1044 (42000): Access denied for user 'dbt_runner'@'%' to database 'analytics_prod'