MetricSign
Start free
High severityauthentication

MySQL Error:
1045

What does this error mean?

MySQL returns error 1045 when a client connection is rejected at the authentication stage. The server received a username/password combination that does not match any row in `mysql.user`, or the user exists but is not granted access from the connecting host. In data-pipeline context this surfaces when an ADF linked service, dbt profile, or Power BI gateway tries to reach a MySQL source with stale or misconfigured credentials. The symptom is immediate: the connection is refused before any query runs, so the entire pipeline activity fails on the first step. You will typically see `Access denied for user 'someuser'@'10.0.0.5' (using password: YES)` in ADF activity output, dbt logs, or the MySQL general/error log.

Common causes

  • 1Incorrect password — the password in your connection string, ADF linked service, or dbt profile does not match the password stored in `mysql.user` for that account.
  • 2Host mismatch — the user exists for `'localhost'` or `'127.0.0.1'` but the client connects from a different IP (e.g., an ADF Integration Runtime at `10.0.0.5`). MySQL treats each user+host pair as a separate account.
  • 3User does not exist — the account was never created, was dropped, or was created with a typo in the username. `SELECT user, host FROM mysql.user;` will confirm.
  • 4Password was changed on the server but not updated in the consuming service — after a credential rotation the old password in ADF, dbt `profiles.yml`, or the Power BI gateway config still gets sent.
  • 5Authentication plugin mismatch — MySQL 8.0+ defaults to `caching_sha2_password`, but older connectors or drivers (e.g., older PyMySQL, certain ODBC versions) only support `mysql_native_password`. The handshake fails before the password is even checked.

How to fix it

  1. 1Step 1: Confirm the user and host grant exist on the server: `SELECT user, host, plugin FROM mysql.user WHERE user = 'your_user';` — if no rows return, the account does not exist.
  2. 2Step 2: If the user exists but only for `localhost`, create a grant for the connecting host or use a wildcard: `CREATE USER 'your_user'@'%' IDENTIFIED BY 'your_password'; GRANT SELECT ON your_db.* TO 'your_user'@'%'; FLUSH PRIVILEGES;`
  3. 3Step 3: If the password is wrong or unknown, reset it: `ALTER USER 'your_user'@'%' IDENTIFIED BY 'new_password'; FLUSH PRIVILEGES;`
  4. 4Step 4: If you suspect an auth-plugin issue (MySQL 8.0+), switch the user to native auth: `ALTER USER 'your_user'@'%' IDENTIFIED WITH mysql_native_password BY 'your_password'; FLUSH PRIVILEGES;`
  5. 5Step 5: Test the connection from the same network as your pipeline runtime: `mysql -u your_user -p -h your_mysql_host --port 3306` — run this from the ADF Self-Hosted IR machine or the dbt runner to rule out network-level blocks.
  6. 6Step 6: Update the credential in all consuming services — in ADF: edit the linked service and click 'Test connection'; in dbt: update `profiles.yml` and run `dbt debug`; in Power BI: go to Settings → Data source credentials → Edit credentials.
  7. 7Step 7: Re-run the failed pipeline activity and verify the connection succeeds before marking the incident resolved.

Example log output

ERROR 1045 (28000): Access denied for user 'etl_user'@'10.0.0.5' (using password: YES)
2026-05-11 08:14:02 [ERROR] ADF activity 'Copy_MySQL_Orders' failed: ErrorCode=UserErrorFailedToConnectToMySql, Message='Access denied for user etl_user@10.0.0.5 (using password: YES)'
2026-05-11 08:14:03 [WARN] dbt source freshness check failed for source.mysql_orders: mysql.connector.errors.ProgrammingError: 1045 (28000): Access denied for user 'analytics'@'%'

Frequently asked questions

Why does MySQL 1045 occur even with the correct password?

MySQL authenticates against a specific user+host pair. If your user is granted for `'localhost'` but the client connects from `10.0.0.5`, the server finds no matching grant and rejects the connection — even though the password is correct. Run `SELECT user, host FROM mysql.user WHERE user = 'your_user';` to see which hosts are allowed, then add a grant for the connecting IP or use `'%'` as wildcard.

How do I reset a forgotten MySQL root password?

Stop the MySQL service, restart it with `--skip-grant-tables`, connect without a password, then run `FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';` and restart MySQL normally. On systemd systems: `systemctl stop mysqld`, edit the unit with `--skip-grant-tables --skip-networking`, start, reset, restore the unit, restart.

Does retrying an ADF pipeline help fix error 1045?

No. Error 1045 is a hard authentication failure, not a transient network issue. Retries will produce the exact same error until the credentials or grants are corrected on the MySQL server and updated in the ADF linked service.

Can MetricSign alert me when an ADF pipeline fails with this error?

Yes — MetricSign captures ADF pipeline failures, extracts the root cause error code from the activity output, and fires an alert with the specific MySQL error. Your team gets notified within minutes, before users notice stale Power BI reports.

Source · dev.mysql.com/doc/mysql-errors/8.0/en/server-error-reference.html

Other authentication errors