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
CREATE TABLE orders (id INT PRIMARY KEY, amount DECIMAL(10,2));
INSERT INTO orders VALUES (1, 100.00), (2, 70.00);Query OK, 0 rows affected (0.01 sec)
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0CREATE DEFINER = 'old_dev'@'%' SQL SECURITY DEFINER VIEW lab_a.order_summary AS SELECT COUNT(*) AS cnt, SUM(amount) AS total FROM lab_a.orders;Query OK, 0 rows affected, 1 warning (0.01 sec)SELECT * FROM lab_a.order_summary;ERROR 1449 (HY000): The user specified as a definer ('old_dev'@'%') does not existSELECT table_name, definer, security_type FROM information_schema.views WHERE table_schema = 'lab_a';+---------------+-----------+---------------+
| TABLE_NAME | DEFINER | SECURITY_TYPE |
+---------------+-----------+---------------+
| order_summary | old_dev@% | DEFINER |
+---------------+-----------+---------------+
1 row in set (0.00 sec)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;Query OK, 0 rows affected (0.01 sec)SELECT * FROM order_summary;+-----+--------+
| 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
CREATE TABLE orders (id INT PRIMARY KEY, amount DECIMAL(10,2), created_at DATETIME);Query OK, 0 rows affected (0.02 sec)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';Query OK, 0 rows affected, 1 warning (0.01 sec)INSERT INTO lab_a.orders (id, amount) VALUES (1, 100.00);ERROR 1449 (HY000): The user specified as a definer ('old_dev'@'%') does not existSELECT trigger_name, definer FROM information_schema.triggers WHERE trigger_schema = 'lab_a';+--------------+-----------+
| TRIGGER_NAME | DEFINER |
+--------------+-----------+
| orders_bi | old_dev@% |
+--------------+-----------+
1 row in set (0.00 sec)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';Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.00 sec)INSERT INTO orders (id, amount) VALUES (1, 100.00);
SELECT * FROM orders;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
DROP USER IF EXISTS 'batch_user'@'%';Query OK, 0 rows affected (0.00 sec)CREATE TABLE orders (id INT PRIMARY KEY, amount DECIMAL(10,2));
INSERT INTO orders VALUES (1, 100.00), (2, 70.00);Query OK, 0 rows affected (0.01 sec)
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0CREATE DEFINER = 'batch_user'@'%' PROCEDURE lab_a.order_total() SQL SECURITY DEFINER SELECT SUM(amount) AS total FROM lab_a.orders;Query OK, 0 rows affected, 1 warning (0.00 sec)CALL lab_a.order_total();ERROR 1449 (HY000): The user specified as a definer ('batch_user'@'%') does not existSELECT routine_name, definer FROM information_schema.routines WHERE routine_schema = 'lab_a';+--------------+--------------+
| ROUTINE_NAME | DEFINER |
+--------------+--------------+
| order_total | batch_user@% |
+--------------+--------------+
1 row in set (0.00 sec)CREATE USER 'batch_user'@'%' IDENTIFIED BY 'Batch#2026' ACCOUNT LOCK;
GRANT SELECT, EXECUTE ON lab_a.* TO 'batch_user'@'%';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.
CALL order_total();+--------+
| 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