Home » Mysql » Export tables with MySQL Workbench with INSERT statements

Export tables with MySQL Workbench with INSERT statements

Posted by: admin November 1, 2017 Leave a comment

Questions:

I am trying to export the DataBase i have at MySQL Workbench but I am having troubles to generate the INSERT statements on the .sql file.

I order to export the data, I do the reverse engineering for the database i want to export. Then, i go to

File / Export/ Forward Engineer SQL CREATE Script

And once in there, i select the option Generate INSERT Statements for Tables.

The result only generates the code for the create tables.

Is there any way to create the insert statements for the data?

Thanks

Answers:

Open MySQL Workbench > Home > Manage Import / Export (Right bottom) / Select Required DB > Advance Exports Options Tab >Complete Insert [Checked] > Start Export.

Questions:
Answers:

You can do it using mysqldump tool in command-line:

mysqldump your_database_name > script.sql

This creates a file with database create statements together with insert statements.

More info about options for mysql dump: https://dev.mysql.com/doc/refman/5.7/en/mysqldump-sql-format.html

Questions:
Answers:

In MySQL Workbench 6.1.

I had to click on the Apply changes button in the insertion panel (only once, because twice and MWB crashes…).

You have to do it for each of your table.

Apply changes button

Then export your schema :

Export schema

Check Generate INSERT statements for table

Check INSERT

It is okay !

Inserts ok

Questions:
Answers:

I had some problems to find this option in newer versions, so for Mysql Workbench 6.3, go to schemas and enter in your connection:

enter image description here


Go to Tools -> Data Export

enter image description here


Click on Advanced Options

enter image description here


Scroll down and uncheck extended-inserts

enter image description here


Then export the data you want and you will see the result file as this:

enter image description here

Questions:
Answers:

Go to Menu Server and Click on Data Export. There you can select the table and select the option Dump Structure and Data’ from the drop-down.