MySQL Error:
1410
What does this error mean?
MySQL raises error 1410 when a GRANT statement references a user account that does not yet exist and the server blocks implicit user creation. In MySQL 5.7.7+ with NO_AUTO_CREATE_USER enabled (the default) and in all MySQL 8.0+ versions, GRANT can only assign privileges to existing accounts — it cannot create them on the fly. In data pipelines this typically surfaces during infrastructure provisioning: a Terraform or Ansible playbook runs a GRANT ... IDENTIFIED BY statement copied from a MySQL 5.6-era runbook, an ADF Linked Service setup script fails to create the service account, or a dbt pre-hook tries to grant permissions to a freshly provisioned replica user. The symptom is immediate — the GRANT fails, the user account is never created, and subsequent pipeline connections fail with Access denied for user.
Common causes
- 1Using the legacy MySQL 5.6 combined syntax `GRANT ... TO 'user'@'host' IDENTIFIED BY 'password'` on MySQL 8.0+, where implicit user creation via GRANT was fully removed. The statement fails even if the executing user has all privileges.
- 2The NO_AUTO_CREATE_USER SQL mode is active (default since MySQL 5.7.7). Even on 5.7.x, this mode blocks GRANT from creating users unless the GRANT includes an IDENTIFIED BY clause — and on 8.0+ the clause itself is removed from GRANT syntax entirely.
- 3The executing MySQL account has GRANT OPTION but lacks the CREATE USER privilege. GRANT can only assign privileges; creating the account requires a separate privilege.
- 4Infrastructure-as-code tools (Terraform mysql_grant resource, Ansible mysql_user module) configured with an older provider version that emits the legacy GRANT syntax instead of CREATE USER + GRANT. Upgrading the MySQL server without updating the provider triggers 1410.
- 5A read-replica promotion or failover script that provisions a replication user via GRANT on the new primary. The script was written for MySQL 5.6 and never updated — the replica starts but the replication user is never created, causing replication to break with 1410 followed by Access denied.
How to fix it
- 1Step 1: Verify MySQL version and current SQL mode: `SELECT VERSION(); SELECT @@GLOBAL.sql_mode;` — check if NO_AUTO_CREATE_USER is present (5.7) or if you are on 8.0+ where it is enforced unconditionally.
- 2Step 2: Create the user as a separate statement before granting: `CREATE USER IF NOT EXISTS 'pipeline_user'@'%' IDENTIFIED BY 'your_password';` — the IF NOT EXISTS clause makes this idempotent for automation scripts.
- 3Step 3: Grant privileges in a second statement: `GRANT SELECT, INSERT, UPDATE ON target_db.* TO 'pipeline_user'@'%'; FLUSH PRIVILEGES;`
- 4Step 4: Verify the account exists and has correct privileges: `SHOW GRANTS FOR 'pipeline_user'@'%';` — confirm that the expected database and table permissions are listed.
- 5Step 5: Search your codebase for legacy GRANT syntax: `grep -rn 'GRANT.*IDENTIFIED BY' /path/to/infra/ --include='*.sql' --include='*.yml' --include='*.tf'` — every match needs to be split into CREATE USER + GRANT.
- 6Step 6: For Terraform, update the MySQL provider to v3.0+ and use separate `mysql_user` and `mysql_grant` resources instead of a single `mysql_grant` with a password. For Ansible, set `state: present` on a `mysql_user` task before the `mysql_query` task that runs GRANT.
- 7Step 7: Test the fix against a MySQL 8.0 instance before deploying: `docker run --rm -e MYSQL_ROOT_PASSWORD=test -p 3307:3306 mysql:8.0` — run your provisioning script against localhost:3307 to confirm no 1410 errors.
Example log output
ERROR 1410 (42000) at line 14: You are not allowed to create a user with GRANT
mysql> GRANT ALL PRIVILEGES ON analytics.* TO 'adf_reader'@'10.0.0.%' IDENTIFIED BY '***';
ERROR 1410 (42000): You are not allowed to create a user with GRANT