1. Home
  2. Technology
  3. MySQL
  4. Migrating MySQL DB Using mysqldump (Linux to Linux OVA)

Migrating MySQL DB Using mysqldump (Linux to Linux OVA)

PREPARE SOURCE MYSQL SERVER:

Step 1) Login via SSH to Variphy Server (Variphy OVA installation assumed)

Step 2)  Identify the desired database to migrate:

mysql – u root -p

mysql> show databases;

Step 2. Backup the database using mysqldump, in this example we will assume database name is variphydb:

mysqldump -u root -p variphydb > variphydb_backup.sql

*Remember the location were you were when you executed the mysqldump command, this is were the variphydb_backup.sql file will be placed if you don’t specify a full path.  If you do forget, you can always find the file by running the following command at the linux prompt:

sudo find / -name ‘variphydb_backup.sql’

Step 3. Allow dump to complete (this may take several minutes/hours) and then transfer the resulting dump file to DESTINATIoN MYSQL SERVER:

For example with SCP:

scp -r variphydb_backup.sql variphyadmin@%DestinationServerIP%:/opt/Variphy/Temp/

PREPARE DESTINATION MYSQL SERVER:

Step 1) Login via SSH to Variphy Server  

Step 2) Confirm DB has successfully been transfered from SOURCE MYSQL SERVER.

From previous SCP transfer in Step 3 above, the file should be located at:  /opt/Variphy/Temp

Step 3) Create new empty DB with same name as original:

mysql -u root -p

mysql> create database variphydb;

Step 4) exit out of myslq and then run the following from the linux command line to Import DB:

mysql -u root -p variphydb < /opt/Variphy/Temp/variphydb_backup.sql

Updated on March 30, 2020

Related Articles