// MySQL error reference

MySQL error 1449: Definer user does not exist

A view, trigger, procedure or event was created with a DEFINER account that no longer exists on this server, so it can't run.

Error number
1449
Name
ER_NO_SUCH_USER
SQLSTATE
HY000
Category
Access and privileges
Error message
The user specified as a definer ('%s'@'%s') does not exist

What it means

Stored programs and views run with the privileges of their DEFINER (unless declared SQL SECURITY INVOKER). If that account is missing, for example after a dump from another server, using the object fails with 1449, which names the missing definer.

Common causes

  • Restoring a dump whose objects were defined by a user that doesn't exist on the new server.
  • Dropping the account that created views or triggers.

How to fix it

  1. Find the objects with the missing definer.

    SELECT table_name FROM information_schema.views WHERE definer = 'olduser@%';
    SELECT trigger_name FROM information_schema.triggers WHERE definer = 'olduser@%';
    SELECT routine_name FROM information_schema.routines WHERE definer = 'olduser@%';
  2. Create the missing account, or recreate the objects with an existing definer.

    CREATE USER 'olduser'@'%' IDENTIFIED BY 'strong-password';
    -- or, for a view:
    ALTER DEFINER = 'app'@'%' VIEW v_orders AS SELECT * FROM orders;
  3. When dumping for another server, strip DEFINER clauses or recreate objects afterwards.

Related errors

More access and privileges errors

The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.

// fewer errors, faster fixes

Work on MySQL in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.