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 3) Exit out of mysql by typing exit at the prompt

mysql> exit

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

sudo 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 5. 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 December 27, 2022

Was this article helpful?

Related Articles