ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation is raised when the current user attempts an operation that requires a high-privilege capability — most commonly SUPER, but also SYSTEM_VARIABLES_ADMIN, REPLICATION_SLAVE_ADMIN, SET_USER_ID, or others — that has not been granted. The error symbol is ER_SPECIFIC_ACCESS_DENIED_ERROR.
Impact
The failing statement is rejected immediately without any partial effect. The surrounding transaction is not automatically rolled back, but the specific operation that triggered the error does not execute. This error surfaces during schema migrations, replication setup, stored routine imports (such as mysqldump restores), or any attempt to change global system variables or definer attributes.
On managed cloud databases (Amazon RDS, Aurora, Cloud SQL, PlanetScale, Azure Database for MySQL), SUPER is intentionally withheld from all users, including the admin account. This makes error 1227 extremely common when restoring dumps created on a self-hosted instance or when running migration scripts that were authored against a root-level account.
Common Causes
Restoring a
mysqldumpthat containsDEFINERclauses. Routines, views, and triggers exported withmysqldumpembedDEFINER=root@localhost`` (or another privileged user). Importing as a different user triggers 1227 because onlySUPER(orSET_USER_IDin MySQL 8.0+) holders may set an arbitrary definer.Creating or altering a stored procedure/function/view/trigger with an explicit
DEFINER. AnyCREATE DEFINER=<other_user> PROCEDURE ...where the current user is not<other_user>and lacksSUPER/SET_USER_IDwill fail.Setting a global or restricted session variable. Some system variables (
sql_log_bin,gtid_next,binlog_format, certaininnodb_*variables) requireSUPERorSYSTEM_VARIABLES_ADMINto modify at runtime.Replication commands.
CHANGE MASTER TO,START SLAVE,STOP SLAVE,RESET SLAVErequireREPLICATION_SLAVE_ADMIN(MySQL 8.0+) orSUPER(MySQL 5.7 and earlier).Killing another user's query.
KILL <thread_id>for a thread belonging to a different user requiresSUPER(MySQL 5.7) orCONNECTION_ADMIN(MySQL 8.0+).Using
SET GLOBALwithout the appropriate dynamic-privilege grant. MySQL 8.0 disaggregated manySUPERoperations into fine-grained dynamic privileges. Code written for 5.7 that relied onSUPERmay fail on 8.0 instances where only the more specific privilege was granted.
Troubleshooting and Resolution Steps
Check what privileges the current user holds.
SHOW GRANTS FOR CURRENT_USER();Look for
SUPER,SYSTEM_VARIABLES_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,REPLICATION_SLAVE_ADMIN, orCONNECTION_ADMINdepending on what operation you need.Strip
DEFINERclauses when restoring a dump on a managed database.Use
sedto remove them before importing:sed 's/\sDEFINER=`[^`]*`@`[^`]*`//g' dump.sql > dump_clean.sql mysql -u admin -p mydb < dump_clean.sqlAlternatively, use
mysqldump --no-definer(available on Percona and some community builds) or pass--set-gtid-purged=OFFwhen the dump was taken from a GTID-enabled source.Grant the required dynamic privilege (MySQL 8.0+) instead of requesting SUPER.
On self-managed MySQL 8.0, grant only the specific privilege needed rather than the broad
SUPER:-- To allow setting global variables: GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO 'appuser'@'%'; -- To allow creating routines with an arbitrary DEFINER: GRANT SET_USER_ID ON *.* TO 'appuser'@'%'; -- To allow replication commands: GRANT REPLICATION_SLAVE_ADMIN ON *.* TO 'appuser'@'%';On Amazon RDS / Aurora, use the managed parameter group for global variable changes.
RDS does not permit
SET GLOBALfor most variables. Instead, modify the DB parameter group in the AWS console or via the AWS CLI:aws rds modify-db-parameter-group \ --db-parameter-group-name my-param-group \ --parameters "ParameterName=max_connections,ParameterValue=500,ApplyMethod=immediate"On Cloud SQL (Google), use instance flags.
Variable changes must be applied as instance flags through
gcloud sql instances patchor the console — not via SQL.Alter the
DEFINERof existing routines after import.If routines were imported with incorrect definers and now fail at execution time, update them:
-- List affected routines SELECT ROUTINE_NAME, DEFINER FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = 'mydb'; -- Update definer (requires SUPER or SET_USER_ID on self-managed MySQL) UPDATE mysql.proc SET definer = 'newuser@%' WHERE db = 'mydb' AND definer = 'root@localhost'; FLUSH PRIVILEGES;On MySQL 8.0, use
ALTER ... SQL SECURITY INVOKERto sidestep the definer issue entirely for views and routines where caller-context execution is acceptable:ALTER VIEW myview SQL SECURITY INVOKER AS SELECT ...;
Additional Information
- The SQLSTATE
42000class covers syntax and access-rule violations; 1227 shares this class with permission-related errors such as 1044 (ER_DBACCESS_DENIED_ERROR) and 1142 (ER_TABLEACCESS_DENIED_ERROR). - MySQL 8.0 introduced role-based access control and broke
SUPERinto over a dozen dynamic privileges (AUDIT_ADMIN,BINLOG_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN, etc.). Always prefer the narrowest privilege on 8.0+. - Some ORMs (Flyway, Liquibase) run schema migrations as the application user. If that user is not
root, migrations that create triggers or stored procedures with implicit definers will fail with 1227. sql_log_bin = 0(a common workaround in replication setups) requiresSUPERon MySQL 5.7 andSYSTEM_VARIABLES_ADMINorSESSION_VARIABLES_ADMINon 8.0.- When error 1227 occurs inside a
mysqldumprestore pipeline, the import process often continues after the error, leaving routines or triggers missing. Always check for errors after restoring a dump rather than assuming success.
Frequently Asked Questions
Why does error 1227 appear on RDS even though I'm using the master user account?
RDS master users are granted most administrative permissions but are explicitly denied SUPER because AWS uses that privilege internally for replication and instance management. For routine and view imports, strip DEFINER clauses from the dump as described above. For global variable changes, use the RDS parameter group.
I'm on MySQL 8.0. How do I know which dynamic privilege replaces SUPER for my use case?
Check the MySQL 8.0 reference for the specific statement failing. The error message often names the required privilege (e.g., you need (at least one of) the SYSTEM_VARIABLES_ADMIN privilege(s)). If it only says SUPER, look up the statement in the MySQL 8.0 privilege documentation — each formerly-SUPER operation now maps to a named dynamic privilege.
Can I grant SUPER to a user on a self-managed MySQL instance?
Yes, on a self-managed instance you can grant SUPER to any user from a root-level account:
GRANT SUPER ON *.* TO 'myuser'@'%';
FLUSH PRIVILEGES;
On MySQL 8.0, prefer fine-grained dynamic privileges over SUPER where possible, as SUPER is considered legacy and may be removed in a future major version.
Why does the error mention a different privilege name than SUPER?
On MySQL 8.0+, the error message reflects the actual dynamic privilege the operation requires rather than the generic SUPER. For example, you may see REPLICATION_SLAVE_ADMIN for replication commands or SET_USER_ID for definer changes. Grant that specific privilege rather than SUPER.