Exporting tables using MySQL Workbench with INSERT statements

I am trying to export a DataBase to my MySQL Workbench, but I am having problems creating INSERT statements in a .sql file.

I want to export data, I am doing reverse engineering for the database I want to export. Then, let's move on to

File / Export / Forward Engineer SQL CREATE Script

And once there, I select the option Generate INSERT statements for tables .

The result only generates code for the create tables.

Can I create insert statements for data?

thank

+45
mysql mysql-workbench
Nov 06
source share
5 answers

For older versions:

Open the MySQL Workbench> Home> Import / Export Management (bottom right) / select the DB you want> Advanced Export Options tab> Paste [Checked]> Start Export.




For 6.1 and above, thanks to ryandlf:

Go to the management tab (next to the diagrams) and select "Export Data."

+57
Nov 06 '12 at 17:11
source share

You can do this using the mysqldump tool on the command line:

mysqldump your_database_name > script.sql 

Creates a file with instructions for creating a database along with insert instructions.

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

+6
Dec 11 '15 at 12:13
source share

In MySQL Workbench 6.1 .

I had to click the Apply changes button on the input panel (only once, because twice and MWB failed ...).

You must do this for each of your tables .

Apply changes button

Then export your schema:

Export schema

Check Generate INSERT statements for table

Check insert

Everything is fine!

Inserts ok

+3
Jun 10 '14 at 10:26
source share

I had problems finding this option in new versions, so for Mysql Workbench 6.3 go to the schemas and enter into your connection:

enter image description here




Go to Tools → Export Data

enter image description here




Click Advanced Options

enter image description here




Scroll down and uncheck extended-inserts

enter image description here




Then export the data you need and you will see the result file as follows:

enter image description here

+2
Jul 14 '17 at 16:51
source share

Go to the "Server" menu and click "Export Data." There you can select the table and select the "Dump structure and data" option from the drop-down list.

+1
Nov 13 '15 at 7:38
source share



All Articles