MySQL 8.4Lab-verified · 2026-11-29

MySQL ERROR 1449 (HY000): The user specified as a definer does not exist

A view, trigger or stored procedure runs as its DEFINER account, and that account does not exist on this server.

MySQL 8.4.13
1449 (HY000): The user specified as a definer ('old_dev'@'%') does not exist

Jump to a cause

  1. 01View created with DEFINER = 'old_dev'@'%', and old_dev does not exist
  2. 02BEFORE INSERT trigger whose DEFINER does not exist
  3. 03Stored procedure whose DEFINER account is missing — create the account

Lab-verifiedReproduced and fixed on MySQL 8.4.13 · 2026-11-29 · container image mysql:8.4

Views, triggers and stored routines in MySQL remember the account that created them (DEFINER). With SQL SECURITY DEFINER (the default) they run with that account's privileges. If the account was dropped, or the objects came from a dump restored on a server where that user was never created, every use fails with ERROR 1449 and the message names the missing account.

The three runs below hit it with a view, a trigger and a procedure. The fixes: find the definer in information_schema, then either change the definer to an existing account or create the missing account.

Note: in these runs the error was reproduced as root. When the ordinary user lab_a selected the same view, MySQL 8.4 answered with an access-denied error instead, so the error you see can depend on who runs the query.

01View created with DEFINER = 'old_dev'@'%', and old_dev does not exist

The view order_summary was created with DEFINER = 'old_dev'@'%' (CREATE VIEW only gave a warning). SELECT * FROM lab_a.order_summary then failed with The user specified as a definer ('old_dev'@'%') does not exist.

information_schema.views showed DEFINER old_dev@%. ALTER DEFINER = 'lab_a'@'%' SQL SECURITY DEFINER VIEW ... AS SELECT ... (the full SELECT has to be repeated) changed the owner, and the view returned cnt 2, total 170.00.

Setup
Setuprun as lab_a
CREATE TABLE orders (id INT PRIMARY KEY, amount DECIMAL(10,2));
INSERT INTO orders VALUES (1, 100.00), (2, 70.00);
OUTPUT
Query OK, 0 rows affected (0.01 sec)

Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0
Setuprun as root
CREATE DEFINER = 'old_dev'@'%' SQL SECURITY DEFINER VIEW lab_a.order_summary AS SELECT COUNT(*) AS cnt, SUM(amount) AS total FROM lab_a.orders;
OUTPUT
Query OK, 0 rows affected, 1 warning (0.01 sec)
Reproducerun as root
SELECT * FROM lab_a.order_summary;
✕ ERROR
ERROR 1449 (HY000): The user specified as a definer ('old_dev'@'%') does not exist
Checkrun as root
SELECT table_name, definer, security_type FROM information_schema.views WHERE table_schema = 'lab_a';
OUTPUT
+---------------+-----------+---------------+
| TABLE_NAME    | DEFINER   | SECURITY_TYPE |
+---------------+-----------+---------------+
| order_summary | old_dev@% | DEFINER       |
+---------------+-----------+---------------+
1 row in set (0.00 sec)
Fixrun as root
ALTER DEFINER = 'lab_a'@'%' SQL SECURITY DEFINER VIEW lab_a.order_summary AS SELECT COUNT(*) AS cnt, SUM(amount) AS total FROM lab_a.orders;
OUTPUT
Query OK, 0 rows affected (0.01 sec)
After the fixrun as lab_a
SELECT * FROM order_summary;
✓ SUCCESS
+-----+--------+
| cnt | total  |
+-----+--------+
|   2 | 170.00 |
+-----+--------+
1 row in set (0.00 sec)

02BEFORE INSERT trigger whose DEFINER does not exist

A BEFORE INSERT trigger on orders had DEFINER old_dev@%. A plain INSERT INTO lab_a.orders failed with 1449, because the trigger fires on every insert.

There is no ALTER for a trigger's definer. information_schema.triggers showed the definer; the trigger was dropped and created again with DEFINER = 'lab_a'@'%'. The insert then succeeded and created_at was set by the trigger.

Setup
Setuprun as lab_a
CREATE TABLE orders (id INT PRIMARY KEY, amount DECIMAL(10,2), created_at DATETIME);
OUTPUT
Query OK, 0 rows affected (0.02 sec)
Setuprun as root
CREATE DEFINER = 'old_dev'@'%' TRIGGER lab_a.orders_bi BEFORE INSERT ON lab_a.orders FOR EACH ROW SET NEW.created_at = '2026-01-01 00:00:00';
OUTPUT
Query OK, 0 rows affected, 1 warning (0.01 sec)
Reproducerun as root
INSERT INTO lab_a.orders (id, amount) VALUES (1, 100.00);
✕ ERROR
ERROR 1449 (HY000): The user specified as a definer ('old_dev'@'%') does not exist
Checkrun as root
SELECT trigger_name, definer FROM information_schema.triggers WHERE trigger_schema = 'lab_a';
OUTPUT
+--------------+-----------+
| TRIGGER_NAME | DEFINER   |
+--------------+-----------+
| orders_bi    | old_dev@% |
+--------------+-----------+
1 row in set (0.00 sec)
Fixrun as root
DROP TRIGGER lab_a.orders_bi;
CREATE DEFINER = 'lab_a'@'%' TRIGGER lab_a.orders_bi BEFORE INSERT ON lab_a.orders FOR EACH ROW SET NEW.created_at = '2026-01-01 00:00:00';
OUTPUT
Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)
After the fixrun as lab_a
INSERT INTO orders (id, amount) VALUES (1, 100.00);
SELECT * FROM orders;
✓ SUCCESS
Query OK, 1 row affected (0.01 sec)

+----+--------+---------------------+
| id | amount | created_at          |
+----+--------+---------------------+
|  1 | 100.00 | 2026-01-01 00:00:00 |
+----+--------+---------------------+
1 row in set (0.00 sec)

03Stored procedure whose DEFINER account is missing — create the account

The procedure order_total had DEFINER batch_user@%, but that user did not exist. CALL lab_a.order_total() failed with ('batch_user'@'%') does not exist.

Here the definer was kept and the account was created instead: CREATE USER 'batch_user'@'%' ... ACCOUNT LOCK and GRANT SELECT, EXECUTE ON lab_a.*. The account is locked so nobody can log in with it, but it still works as a definer. CALL order_total() returned total 170.00.

Setup
Setuprun as root
DROP USER IF EXISTS 'batch_user'@'%';
OUTPUT
Query OK, 0 rows affected (0.00 sec)
Setuprun as lab_a
CREATE TABLE orders (id INT PRIMARY KEY, amount DECIMAL(10,2));
INSERT INTO orders VALUES (1, 100.00), (2, 70.00);
OUTPUT
Query OK, 0 rows affected (0.01 sec)

Query OK, 2 rows affected (0.00 sec)
Records: 2  Duplicates: 0  Warnings: 0
Setuprun as root
CREATE DEFINER = 'batch_user'@'%' PROCEDURE lab_a.order_total() SQL SECURITY DEFINER SELECT SUM(amount) AS total FROM lab_a.orders;
OUTPUT
Query OK, 0 rows affected, 1 warning (0.00 sec)
Reproducerun as root
CALL lab_a.order_total();
✕ ERROR
ERROR 1449 (HY000): The user specified as a definer ('batch_user'@'%') does not exist
Checkrun as root
SELECT routine_name, definer FROM information_schema.routines WHERE routine_schema = 'lab_a';
OUTPUT
+--------------+--------------+
| ROUTINE_NAME | DEFINER      |
+--------------+--------------+
| order_total  | batch_user@% |
+--------------+--------------+
1 row in set (0.00 sec)
Fixrun as root
CREATE USER 'batch_user'@'%' IDENTIFIED BY 'Batch#2026' ACCOUNT LOCK;
GRANT SELECT, EXECUTE ON lab_a.* TO 'batch_user'@'%';
OUTPUT
Query OK, 0 rows affected, 1 warning (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Useful when many objects share the same missing definer, such as after restoring a dump on a new server.

After the fixrun as lab_a
CALL order_total();
✓ SUCCESS
+--------+
| total  |
+--------+
| 170.00 |
+--------+
1 row in set (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

FAQ

How do I find which objects use the missing definer?

Query information_schema: views, triggers and routines all have a DEFINER column. Filter by the account named in the error message.

Why did this start after I restored a mysqldump?

The dump keeps the DEFINER clauses of views, triggers and routines. If that account does not exist on the new server, the objects are created (with a warning) but fail when used.

How do I change the definer of a trigger?

There is no ALTER for it. Drop the trigger and create it again with the new DEFINER, as in the trigger case above.

Can I just create the missing user instead?

Yes. Create the account and grant it the privileges the objects need. In the procedure case it was created with ACCOUNT LOCK and still worked as the definer.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test, each with full rights on a database of the same name (its default database); root is the administrator. MySQL 8.4.13