databasemysqlmysqladmin

mysqldump data through command line without affecting web application


I read some topics on restoring and copying mysql database from 1 server to another

But I wanted to be make sure the impact it might have on my production web app.

So basically here is my situation:

Server A has a database called enrollment.

Server B has a database called enrollment.

Through the command line, how do I do the following:

1.Create a backup copy of 'enrollment' on Server A

2. Drop database enrollment on Server A

3. Copy/Dump database enrollmentt from Server B to Server A( do I need to ssh or copy the sql file or can do i do it throug mysql?)

The databse size is about 64 MB.

While i do the above, how long will the production web app be impacted?

based on my research, this was my thinking, but I wanted to be careful since I am dealing with production data

  1. On server B, mysqldump --databases enrollment > enrollment_backup.sql

  2. scp enrollment_backup.sql from Server B to Server A

  3. drop database enrollment

  4. mysqldump < enrollment_backup.sql

Note: I have root access on server A & server B.


Solution

  • You have to do the drop database in the last step: 1) backup server A 2) dump data A on server B 3) change the web app to point to B 4) if everything is ok you can drop server A