- Newest
- Most votes
- Most comments
I needed to copy an RDS DB from one AWS account to another. I couldn't restore from snapshot initially because the database was encrypted through the default KMS keys. So I tried taking a dump of the database and importing it into the new RDS and this is where I was having trouble. The workaround that I found was to take a snapshot and copy the encrypted snapshot using a custom KMS keys that I can share with the new account and then restore the db using the custom KMS in the new account. This workaround ended up working for me.
answered 2 years ago
Check what action on line 14 is being performed. As per AI some actions are limited only to AWS
Thank you so much for asking the question.
To set a global system variable runtime value, use the SET GLOBAL statement, which requires the SYSTEM_VARIABLES_ADMIN privilege (or the deprecated SUPER privilege) [1]. However, Aurora MySQL 3 doesn't support SYSTEM_VARIABLES_ADMIN privilege for rds_superuser_role which is assigned to default super user [2].
Please simply delete line 14 and rerun the dump script.
I hope this might help.
[1] : https://dev.mysql.com/doc/refman/8.0/en/system-variable-privileges.html
[2] : https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.MasterAccounts.html
The error you're encountering is a common issue when importing data into Amazon RDS MySQL instances, especially after upgrading to MySQL 8. This error occurs because RDS restricts certain privileges for security reasons, including the SUPER and SYSTEM_VARIABLES_ADMIN privileges.
To resolve this issue, you can try the following approaches:
-
Modify your dump file: Open your db1.sql file and remove or comment out any statements that require SUPER or SYSTEM_VARIABLES_ADMIN privileges. This includes statements like SET @@GLOBAL.GTID_PURGED and other global variable settings.
-
Use the --set-gtid-purged=OFF option: You've already used this option during the export, which is good. Make sure to keep using it for future exports.
-
Grant necessary privileges: If possible, grant the SESSION_VARIABLES_ADMIN privilege to the user you're using for import. You can do this by running: GRANT SESSION_VARIABLES_ADMIN ON . TO 'username'@'%'; However, note that you might encounter another error if you don't have the GRANT OPTION privilege.
-
Use the RDS-specific stored procedure: Amazon RDS provides a stored procedure to set the GTID_PURGED value. You can try using this after importing your data: CALL mysql.rds_set_configuration('gtid_purged', '');
-
Check and adjust the DB cluster parameter group: Ensure that the gtid_mode parameter is set to OFF in the DB cluster parameter group associated with your Aurora cluster.
-
Create a new user with required privileges: If possible, create a new database user with the necessary privileges for the import operation.
If these solutions don't work, you might need to contact AWS Support for further assistance, as they may be able to provide more specific guidance based on your RDS configuration.
Remember to always backup your data before performing any import operations, and test the process in a non-production environment first if possible.
Sources
Can't use mysqlimport since MySQL 8 upgrade due to insufficient privileges | AWS re:Post
cannot purge GTID for Aurora RDS mysql | AWS re:Post
Granting privileges for Importing data to AWS Lightsail MySQL | AWS re:Post
RDS MySQL Database Migration and Privilege Error | AWS re:Post

Line 14 /*!50606 SET GLOBAL INNODB_STATS_AUTO_RECALC=OFF */;Delete line 14
Deleted line 14 then encountered permission issues with the root user. I found a workaround