Taking the backukup
mysqldump --all-databases --single-transaction --master-data=1 > all-db-backup.sql
after the backup is complete
We need to rename the db for example the sakila db has to rename to test_sakila.
sed -i '/^CREATE DATABASE\|^USE/{
s/onedb/test_one/;
s/testdb/prd_test/;
s/prod_kiran/test_kiran/;
s/sakila/test_sakila/;
s/test/test_test/}' all-db-backup.sql
## then on the test server run the following command.
mysql -u kiran -pkiran < /home/kiran/all-db-backup.sql
mysqldump --all-databases --single-transaction --master-data=1 > all-db-backup.sql
after the backup is complete
We need to rename the db for example the sakila db has to rename to test_sakila.
sed -i '/^CREATE DATABASE\|^USE/{
s/onedb/test_one/;
s/testdb/prd_test/;
s/prod_kiran/test_kiran/;
s/sakila/test_sakila/;
s/test/test_test/}' all-db-backup.sql
## then on the test server run the following command.
mysql -u kiran -pkiran < /home/kiran/all-db-backup.sql

Really Good article.
ReplyDeleteThanks Kiran