I have inherited a MySQL DB that takes 220 GB of storage. The machine that it's on is 255 GB, leaving 35 GB free. We are in the process of rewriting the application and will be refactoring the DB as well. We would like to take dumps of the data to move them to a newer/larger DB but we're not sure the best way to do it is, considering we can't increase space nor can we attach additional storage. What is the best way to migrate this data?

Thank you,

  • By "to move them to a newer/larger/ DB" does this mean you are migrating the data to a new server? Or are you using the same hardware for the re-written application? – mrwhale Dec 12 '16 at 1:10
  • 1
    How do you normally access this database? It seems unlikely that there is no network access to the machine. – Ouroborus Dec 12 '16 at 1:55
  • Why can't you get a USB hdd, format it mount it, and copy the data over? – cybernard Dec 12 '16 at 4:55
  • Sorry if I didn't make myself clear. The original machine is at a host that is behind a VPN. We don't have physical access to the machine. – StackOverflowed Dec 12 '16 at 13:09

You need network connectivity on both computers.

On new server:

mkdir /old server/
mysqldump -h <old server ip or dns> -c <database name> >/old server/database.sql

For example:

mysqldump -h -c server /old sever/server.sql

On the new server the database can be imported. You may have to pre-create a blank database of that database name first.

mysql -u root -ppassword server  <server.sql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.