Problem description
When I create a stored procedure, function, trigger, event, or view, one of the following errors occurs.
When I import an SQL script to the RDS instance, one of the following errors occurs. In most cases, the SQL script is the used for an on-premises database.
When I download the logical backup files of an RDS instance and import them to the RDS instance or an on-premises database, one of the following errors occurs. The error code may be 1227 or 1725.
When I execute a MySQL statement to modify parameters, one of the following errors occurs.
[Err] 1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation
ERROR 1725 (HY000) at line 1936: OPERATION need to be executed set by ADMIN
ERROR 1227 (42000) at line 2984: Access denied; you need (at least one of) the SUPER privilege(s) for this operation Causes
When data is imported to the RDS instance, specific SQL statements, such as
DEFINERandGTID_PURGED, can be executed only if your account is granted the SUPER permission. ApsaraDB RDS for MySQL does not provide the SUPER permission. As a result, the SQL statements must be removed.No global transaction identifier (GTID) is assigned to the RDS instance.
Database accounts do not have sufficient permissions to modify specific parameters by executing MySQL statements. Example: SET GLOBAL event_scheduler = 1.
Solution
Use the privileged account to import data to the RDS instance. If you do not have the required permissions, contact your administrator.
Delete the DEFINER statement from the SQL script that you want to import.
Check your SQL file and remove statements that are similar to the following example:
DEFINER=`root`@`%`In Linux, run the following command to remove the statements:
sed -ie 's/DEFINER[ ]*=[ ]*[^ ]*/ / ' your.sql
Delete the GTID_PURGED statement from the SQL script that you want to import.
NoteWhen you export data from an on-premises database, you can add the
--set-gtid-purged=offsetting aftermysqldumpto cancel the output of the GTID_PURGED clause.Check your SQL file and remove statements that are similar to the following example:
SET @@GLOBAL.GTID_PURGED='d0502171-3e23-11e4-9d65-d89d672af420:1-373, d5deee4e-3e23-11e4-9d65-d89d672a9530:1-616234';In Linux, run the following command to remove the statements:
awk '{ if (index($0,"GTID_PURGED")) { getline; while (length($0) > 0) { getline; } } else { print $0 } }' your.sql | grep -iv 'set @@' > your_revised.sql
Application scope
ApsaraDB RDS for MySQL