Here you can either Import from the dump project folder or import by using a single self-contained file. It will open the ‘Data import’ window which is exactly opposite to the data export window as shown in the below image. Go to the top ‘Server’ menu and select the ‘Data Import’ option as shown in the below image.
#MYSQL DATABASE WORKBENCH FOR DUMMIES HOW TO#
Now let’s learn how to import the database and tables using the MySQL workbench. Once the Export did successfully, go to the folder location where this file saved and you will see under the dumps folder, we have a single dump file that includes all the databases and tables, and data rows as shown in the below image.īefore Importing the database, let us first delete the tables which are already there in the school database by executing the below SQL statement. Now again go to the Server => Data Export window and this time select Export to self-contained file option and click on the Start Export button as shown in the below image. Now, if you go to the location where it saved the file, then you will see multiple SQL files which are nothing but individual tables as shown in the below image. Once you click on the start export button it will display the progress bar and log as shown in the below image. Let’s export the database using the first option ‘Export to Dump Project Folder’ as shown in the below image.įinally, click on the start export button to start export functionality as shown in the below image. We will export the database using both the method, to understand the difference.
This is a good option when you will be importing all the databases, tables, and data rows by using a single SQL file.
The second option Export to Self-contained File will store all the databases and tables in a single SQL file. By selecting the first option that is ‘Export to Dump Project Folder’, MySQL Workbench will save all the tables as separate SQL files under one folder which is useful when you will be importing or restoring the export file one by one table. Under the Export Options section, you can change the default export path of your choice and I am going with the default one. Let’s choose the ‘Dump Structure and Data’ option to save both table structure and data rows in it as shown in the below image. The Dump Structure and Data option will save both data and structure. While ‘Dump Data Only’ option will save only the inserted rows in the tables.
That is database columns and data types defined by us. The ‘Dump Structure Only’ option will save only the table structure. In the drop-down setting, we can select ‘Dump Structure Only’, ‘Dump Data Only’ or ‘Dump Structure and Data’ option. And in the right-side pane, select the students and studentaddress table as shown in the below image. So, let’s select our school database which we created earlier. We can also select one or more tables from the right section of this window. We can select one or more database check-boxes to include the database in the Export file. When we select a database by clicking on it, it will display all the respected tables under the selected database. The left section on the window displays all the existing databases on our MySQL database server. It will open the data export settings and options window as shown below. To do so, from the top menu select ‘Server’ and ‘Data Export’ Option as shown in the below image. Now let us see how to export the School database. INSERT INTO `school`.`studentaddress` (AddressId, StudentId, City, State) VALUES (2, 'Priyanka', 'Dewangan', 'Second', 17) INSERT INTO `school`.`students` (StudentId, FirstName, LastName, Class, Age) Please use the below SQL Script to create the database, table, and data. So, let us first create a Database called School and tables Students and StudentAddress with some data. In order to export a database using MySQL Workbench, we should have a database on our MySQL Server. Export MySQL database using MySQL Workbench:
#MYSQL DATABASE WORKBENCH FOR DUMMIES UPDATE#
Please read our previous article, where we discussed how to Insert, Update and Delete Data Rows using MySQL Workbench. In this article, I am going to discuss how to Export and Import MySQL Database using MySQL Workbench. Data Structures and Algorithms Tutorialsĭatabase Export and Import Using MySQL Workbench.