AWS Import / Export DUMPS from RDS MySQL

So when you are exporting a MySQL Dump from RDS in AWS and Import to another RDS Instace, you are becoming an error by importing your dump file.

Access denied; you need the SUPER privilege for this operation

https://forums.aws.amazon.com/message.jspa?messageID=183618

 

Export your MySQL to a Dump

 mysqldump -h mydb.tasdasdasd.eu-central-1.rds.amazonaws.com -u my_qa -p my_q > my_qa.sql

In your exported dump file

 

/*!50003 CREATE*//*!50017 DEFINER=`root`@`localhost`*//*!50003TRIGGER temp_product_feature_insert

root@localhost is your enemy 😀

 

Modify your Dump

Import your MySQL Dump after modify with set to your target RDS instance

You must replace it with sed

sed -e 's/DEFINER=`.*`@`.*`/DEFINER=CURRENT_USER /g' my_qasql > fixed_my_qa.sql

This change all entry´s to

/*!50003 CREATE*/ /*!50017 DEFINER=CURRENT_USER */ /*!50003 TRIGGER temp_product_feature_insert

 

Import your MySQL Dump after modify with set to your target RDS instance

mysql -h myprod.dfsfsdfe3.eu-central-1.rds.amazonaws.com -u my_prod -p myproddb_p  < fixed_my_qa.sql

 

 

 

One thought on “AWS Import / Export DUMPS from RDS MySQL

  1. Pingback: AWS Import / Export MySQL Dumps | Konkretor Blog, IT Stuff and more

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s