Audvik Labs

How to copy database from one MySQL server to Amazon MySQL RDS

copy-database-mysql-server-amazon-rds

I have observed that when people start a WordPress website they generally put the complete architecture (Database and App Server) on one server. Once they reach a certain load they have to either vertically scale the server and keep on spending money to this architecture. I have been always fostering about Highly Salable Architectures so one of my solutions to a client was to move their Database to Amazon RDS and then enable snapshots over there. In order to move the database the first request was to create a snapshot of the database and then update restore the new database with the snapshot. In order to do that following two commands are quite handy.

  1. Create a Database Dump using the following command
    1. > mysqldump -h server_one_endpoint -u username -p database_name > dump.sql
  2. Restore the database dump to your RDS using following command
    1. > mysql -h xyz.region.rds.amazonaws.com -u username -p database_name < dump.sql

More information about the mysqldump utility can be found here.

To downloaded MySQL database from here.

Leave a comment

Your email address will not be published. Required fields are marked *