Backing up and Restoring droplet MySQL database on my Windows computer

April 28, 2015 1.4k views
MySQL Backups CentOS

My Centos 6 droplet is running MySQL 5.1 . I have created and have been running an extensive database on the droplet .I've been controlling the droplet via a Putty console on my Windows 7 machine. What would be the best way for me to back up the content of my MySQL database onto my Windows machine and restore from it to the droplet ?

1 Answer

The most direct method would be to use mysqldump to create a backup of your database as a .sql file. This guide from the official documentation should be helpful.

To re-import this data to your server you would want to drop all tables in your database and then import the .sql file:

mysql -uroot -p mydatabase < mybackup.sql
Have another answer? Share your knowledge.