Open In App

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

Improve
Improve
Like Article
Like
Save
Share
Report

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

Data-to-be-imported

 

Import a Whole Database

Step 1: In the tab Server click Data Import.

Clicking-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.

Path-and-script-selection

 

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

choosing-target-schema

 

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

clicking-start-import

 

Step 5: Wait for the import to finish.

Import-in-process

 

Below image shows that the import is completed.

Import-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.

Clicking-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.

Schema-and-Table-Selection

 

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.

Path-selection

 

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

Export-in-progress

 

Below image shows that the data is exported.

Export-completed

 

Generated SQL File

SQL-Script

 

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


Last Updated : 02 Jan, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads