Saturday, June 14, 2014

MySQL Workbench Data Export and Import/Restore

Data Export


MySQL offers multiple types of operations for backing up the data. If you don't have an Enterprise Edition installed, backup can be taken by using Data Export option in MySQL Workbench




Here you can select a database that has to be exported and the tables of the database. There are other options below in which you can export Stored Procedures and you can skip table data while exporting etc. After selecting the database and tables, you can click on "Start Export" button. If any error occurs after clicking the button, stating mysqldump verification then you should give correct location of mysqldump.exe on your computer. This can be set by going to Edit --> Preferences --> Administrator. After going there, you can specify the path for mysqldump.exe file which exists in the following location,

C:\Program Files\MySQL\MySQL Server 5.6\bin

Now clicking on "Start Export" in the Data Export Wizard exports tables to a specified location either as individual .sql files or all tables and data into a single .sql file. This depends on your requirement. The exported .sql files contains the CREATE and INSERT statements for each table. The status of Export operation can be observed in the adjacent tab.

Data Import/Restore


Data Export is like backing up database while Import/Restore refers to Restoring the database. For this, there is an option Data Import/Restore in Workbench which takes you to Data Import Wizard. This is very simpler than Data Export. All you need to do is specifying the dump location of .sql files which is formed during Data Export. If you're importing data from a single .sql file then you can specify the target database into which data is to be imported, if the file doesn't have schema. Like Export Wizard, you can see the progress of Import Operation in the adjacent tab.


No comments:

Post a Comment