Open In App

How to Import and Export Data to Database in MySQL Workbench?

Utilizing MySQL Workbench, a unified visual database designing or graphical user interface tool is necessary when working with database architects, developers, and administrators. It was made and is updated by Oracle. It offers comprehensive administration tools for server configuration, user administration, backup, and many other tasks as well as SQL development, data modeling, and data migration. This Server Administration can be used for developing new physical data models, E-R diagrams, and SQL. (Complete inquiries, etc.) All widely used operating systems, including Windows, Mac OS, and Linux, are compatible.

You can import the current data and/or the entire database into MySQL Workbench and store it. In essence, it converts the current data into SQL query statements, adds it to a SQL file made when you import the data, and so on. In light of this, when you run this SQL script, the written queries are carried out, a database is created, tables are built, and data is inserted in accordance with the instructions.



SQL Script

 

Import a Whole Database

Step 1: In the tab Server click Data Import.

 

Step 2: You will see a new screen with different options for data import. First of all, select the path in which your SQL script is. It can be in one file or a folder in which different SQL files for different tables reside. Choose the appropriate option.



 

Step 3: Choose the target schema. Target schema is the existing schema to which the data is imported.

 

Step 4: After choosing the necessary options, click Start import in the below right corner.

 

Step 5: Wait for the import to finish.

 

Below image shows that the import is completed.

 

Now, the tables or/and schema will be created with the data and you can see that in the schema list.

Export a Whole Database

Step 1: In the tab Server click Data Export.

 

Step 2:  You will see a new screen with different options for data export. First, select the schema(database) you wish to export. After choosing that, all the tables in that schema will be selected by default for export. You can uncheck the tables you do not want to export.

 

Step 3: Select the path and method for the format you want to export the data in. You can append the data of all tables or you can create individual files for each table. You can also add the query to first create schema and then insert the data.

 

Step 4: After selecting all the required options, click Start Export in the bottom right corner.

 

Below image shows that the data is exported.

 

Generated SQL File

 

As seen, it is basically a set of SQL queries.

Article Tags :