How to backup and restore MySQL DB using MySQL Workbench
For those database administrators out there who mainly deal with Microsoft SQL Server environments, you may wonder what tool you use to interact with MySQL and perform the necessary functions that most admins are used to performing with Microsoft SQL Management Studio. ย The equivalent utility that can be used to manage your MySQL environment is calledย MySQL Workbench. ย This is a free download from the MySQL development site and can be found here: ย https://dev.mysql.com/downloads/workbench/
Backing up and restoring DBs
Once you have downloaded and installed MySQL Workbench, you will need to first establish communication with your MySQL server. ย It is easy to see if you need to make connection changes with the “Test Connection” button that is found in the connection setup screen. ย You want to see the result:
So after you are able to get a successful connection to your MySQL server, then you are ready to proceed to connect and backup the files and also create a connection and follow the same procedures for testing this with the destination server if it is a different server than the source. ย Over on the right hand side of your MySQL workbench, you will see the “Server Administration” console function. ย Underneath that, you will see the Manage Import / Export option which is what we will be using to backup and restore the DB.
When you click the Manage Import / Export link, you will be prompted with theย Select Server to Connect to:ย dialog box which basically displays for you the servers that you currently have established connections for. ย So a prerequisite to this step is that you will need to have added the servers as a connection in the Workbench.
You will then be prompted for credentials needed to connect to this server.
Once connected, you will see the available DB’s that you can choose to backup. ย Select the DB you want to backup.
At the bottom of this screen, you will see the options available to backup your DB. ย We have chosen here to Export our DB to a “self-contained file” which makes things a little easier as you only have one restore file to work with. ย You can also choose to export the backup to a dump project folder which dumps each table to a separate file, allowing you a little more control over which things you want to restore. ย However, for our purposes, we know that we want to restore everything so we are selecting the self-contained file.
After you have made your selections, you need to click theย Start Exportย button.
Below is theย Export Progressย screen which essentially lets you see the progress of your DB backup/export.
Restoring/Importing your DB
Our steps here are basically the reverse of what we did before. ย On the left hand side of the console under Data Export / Restoreย you will selectย Data Import/Restore this time. ย Also, you will notice that we are pointing the import to the folder/backup file we created in the backup process above.
After selecting your options, simply clickย Start Import
Final Thoughts
If you work with MySQL to any degree, you will definitely want to download a copy of the MySQL Workbench as it makes administering MySQL a breeze with most of the GUI functionality that admins would expect from a SQL Management console. ย The backup/restore process is also very painless and most admins will feel at home with the point and click process the Workbench presents.