mysqldude
Error codes › 1449

MySQL & MariaDB error 1449: The user specified as a definer does not exist

MySQLThe user specified as a definer ('…'@'…') does not exist
MariaDBThe user '…'@'…' does not exist
Example from our test runs: The user specified as a definer ('olddev'@'%') does not exist (5.6.51) · The user specified as a definer ('olddev'@'%') does not exist (10.6.28)

A view, trigger, stored routine or event runs with the privileges of its DEFINER account, and that account no longer exists, typically after copying a database to another server or dropping an old user.

MySQLMariaDB
SymbolER_NO_SUCH_USERER_NO_SUCH_USER
SQLSTATEHY000HY000
TypeServer errorServer error
Versionsevery release since 5.0 activeevery release since 5.5 active

What it means

The user specified as a definer ('olddev'@'%') does not exist. Views, triggers, procedures, functions and events default to SQL SECURITY DEFINER: they run with the privileges of the account that created them. If that account is missing, the server can’t run them, so even a plain SELECT from a view, or an INSERT that fires a trigger, fails.

Why it happens

  • Restoring a dump on another server: mysqldump keeps DEFINER='olddev'@'%', but that account doesn’t exist there.
  • The developer account that created the objects was dropped.
  • The host part doesn’t match ('app'@'localhost' exists, the definer is 'app'@'%').

MySQL 8.0.22+ helps prevent this: DROP USER warns (4005, “referenced as a definer account”) when the account still owns objects, and our tests show that warning on MySQL 8.0–9.x. MariaDB and MySQL 5.x drop the user silently.

How to fix it

  • Find affected objects: SELECT table_name, definer FROM information_schema.VIEWS WHERE definer NOT IN (SELECT CONCAT(user, '@', host) FROM mysql.user); (and the same against ROUTINES, TRIGGERS, EVENTS).
  • Re-point them at an existing account: ALTER DEFINER = CURRENT_USER VIEW v AS … (views, events), or drop and re-create triggers and routines.
  • Or create the missing account with the needed privileges.
  • Consider SQL SECURITY INVOKER for views that don’t need elevated privileges.

Reproduce it yourself

These steps are the exact test our harness runs. Use a scratch server, never production.

  1. Connect with mysql -u root -p and create a scratch database and the test data:

    CREATE DATABASE demo;
    USE demo;
    CREATE TABLE t (a INT);
    INSERT INTO t VALUES (1);
  2. Run:

    CREATE USER 'olddev'@'%' IDENTIFIED BY 'Test#1234';
    GRANT SELECT ON demo.* TO 'olddev'@'%';
    CREATE DEFINER = 'olddev'@'%' SQL SECURITY DEFINER VIEW v AS SELECT a FROM t;
    DROP USER 'olddev'@'%';
    SELECT * FROM v;

You get: The user specified as a definer ('olddev'@'%') does not exist(11.8.9)

Verified fixes

  1. Re-create the object with an existing definer (ALTER ... DEFINER), or SQL SECURITY INVOKER

    CREATE USER 'olddev'@'%' IDENTIFIED BY 'Test#1234';
    CREATE DEFINER = 'olddev'@'%' SQL SECURITY DEFINER VIEW v AS SELECT a FROM t;
    DROP USER 'olddev'@'%';
    ALTER DEFINER = CURRENT_USER SQL SECURITY INVOKER VIEW v AS SELECT a FROM t;
    SELECT * FROM v;
  2. Find objects whose definer no longer exists

    CREATE USER 'olddev'@'%' IDENTIFIED BY 'Test#1234';
    CREATE DEFINER = 'olddev'@'%' VIEW v AS SELECT a FROM t;
    DROP USER 'olddev'@'%';
    SELECT TABLE_NAME, DEFINER FROM information_schema.VIEWS WHERE TABLE_SCHEMA = DATABASE() AND DEFINER NOT IN (SELECT CONCAT(user, '@', host) FROM mysql.user);

Tested on

StepMySQLMariaDB
5.65.78.08.4910.610.1111.411.8
A view whose DEFINER account was dropped (common after copying a database between servers)
repro
✓ 1449✓ 1449✓ 1449✓ 1449✓ 1449✓ 1449✓ 1449✓ 1449✓ 1449
Re-create the object with an existing definer (ALTER ... DEFINER), or SQL SECURITY INVOKER
fix
✓✓⚠ 4005⚠ 4005⚠ 4005✓✓✓✓
Find objects whose definer no longer exists
fix
✓✓⚠ 4005⚠ 4005⚠ 4005✓✓✓✓
A view whose DEFINER account was dropped (common after copying a database between servers) repro
MySQL 5.6✓ 14495.7✓ 14498.0✓ 14498.4✓ 14499✓ 1449
MariaDB 10.6✓ 144910.11✓ 144911.4✓ 144911.8✓ 1449
Re-create the object with an existing definer (ALTER ... DEFINER), or SQL SECURITY INVOKER fix
MySQL 5.6✓5.7✓8.0⚠ 40058.4⚠ 40059⚠ 4005
MariaDB 10.6✓10.11✓11.4✓11.8✓
Find objects whose definer no longer exists fix
MySQL 5.6✓5.7✓8.0⚠ 40058.4⚠ 40059⚠ 4005
MariaDB 10.6✓10.11✓11.4✓11.8✓
✓works ✓ 1062fails with the error the step demonstrates ⚠works with a warning ≠runs, result differs ✗fails Tested 2026-11-25 on 5.6.51, 5.7.44, 8.0.46, 8.4.13, 9.7.4, 10.6.28, 10.11.19, 11.4.13, 11.8.9
What the warnings and failures say (2)
  • Re-create the object with an existing definer (ALTER ... DEFINER), or SQL SECURITY INVOKER (MySQL 8.0, MySQL 8.4, MySQL 9): warning 4005: User 'olddev'@'%' is referenced as a definer account in a view.
  • Find objects whose definer no longer exists (MySQL 8.0, MySQL 8.4, MySQL 9): warning 4005: User 'olddev'@'%' is referenced as a definer account in a view.

Related errors

  • 1227 ER_SPECIFIC_ACCESS_DENIED_ERRORexplained
  • 1356 ER_VIEW_INVALID
  • 4005 ER_USER_REFERENCED_AS_DEFINER
How the message changed between versions
MySQL fromSymbolMessage
5.0.96ER_NO_SUCH_USERThere is no '%-.64s'@'%-.64s' registered
5.1.77ER_NO_SUCH_USERThe user specified as a definer ('%-.64s'@'%-.64s') does not exist
MariaDB fromSymbolMessage
5.5.68ER_NO_SUCH_USERThe user specified as a definer ('%-.64s'@'%-.64s') does not exist
12.0.2ER_NO_SUCH_USERThe user '%-.64s'@'%-.64s' does not exist