The following information contains the commands required to create a DB dump of your database. It also gives the commands to export your database to your new database. The information required to edit the copy of your database by replacing information is located here as well.

mysqldump:

mysqldump -u root -p Abrahams > update.dmp

Conneting to mysql RDS instance:
mysql -h wordpressdb.c2esvr2yf8rb.us-east-1.rds.amazonaws.com -P 3306 -u Imraan -p —Connects to RDS DB
mysql -h wordpressdb.c2esvr2yf8rb.us-east-1.rds.amazonaws.com -P 3306 -u Imraan -p WordPressDB –Connects directly to DB

Creating a Dump:
mysqldump -h wordpressdb.c2esvr2yf8rb.us-east-1.rds.amazonaws.com -P 3306 -u Imraan -p WordPressDB > test2.mysql

mysqldump -u Imraan -p WordPressDB > test2.mysql

-Wordpress DB -This is the name of the database you are creating a copy of test2.mysql or test2.dmp (Can be in either format) is the copy of the database you created(dump)

Importing Dump to DB:
mysql -h wordpressdb.c2esvr2yf8rb.us-east-1.rds.amazonaws.com -P 3306 -u Imraan -p WordPressDB < Abrahams.mysql

-Abrahams.msql is the copy of the database you are copying to the new database
-WordpressDB is the new database, you can create this databse prior to copying the copy over or create the database name using the command above. When executing the command, the databse will be created automatically

 

Command to replace 52-29-00-204 with 34-232-000-220.

 

 

:%s/ip/ip/g ( g = globally)

If you need to replace /var/www/html for example

:%s#/var/www/html#/var/www/vhosts#g Using the hash instead of / here

 

 

:%s#https://ec2-52-29-000-204.eu-central-1.compute.amazonaws.com#https://ec2-34-232-000-220.compute-1.amazonaws.com#g

substitution:

 

mysql -h wordpress-db.c2esvr2yf8rb.us-east-1.rds.amazonaws.com -P 3306 -u Imraan -p WordPressDB < update.dmp

Leave a Reply

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