Export DataBase with MySQL Workbench with INSERT statements

后端 未结 7 2084
借酒劲吻你
借酒劲吻你 2020-12-13 12:19

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,

相关标签:
7条回答
  • 2020-12-13 12:29

    For the latest version of MySql Workbench

    1. Click on the Server menu in the top menu bar
    2. Select 'Data Export' submenu
    3. It will open up the Object Selection window where you can select the appropriate database which has the desired tables
    4. Once you select the database in the left side all the tables will appear in the right side with radio buttons
    5. Select the radio buttons in front of needed tables
    6. Just below the table selection you can see a dropdown to select Dump Structure Only or Data only or Structure & Data
    7. Under Objects to Export tick the box if you need stored procedures or events also. If you don't need those then untick those
    8. Under export option change the exporting file name and path
    9. If you want to create the schema once you import the dump file then tick include create schema
    10. Press Start Export button in the right-hand side corner. once it successful the summary will be showing in the Export progress tab
    0 讨论(0)
  • 2020-12-13 12:32

    If you want to export just single table, or subset of data from some table, you can do it directly from result window:

    1. Click export button:

    2. Change Save as type to "SQL Insert statements"

    0 讨论(0)
  • 2020-12-13 12:38

    For older versions:

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


    For 6.1 and beyond, thanks to ryandlf:

    Click the management tab (beside schemas) and choose Data Export.

    0 讨论(0)
  • 2020-12-13 12:40

    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

    0 讨论(0)
  • 2020-12-13 12:48

    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

    0 讨论(0)
  • 2020-12-13 12:51

    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:


    Go to Tools -> Data Export


    Click on Advanced Options


    Scroll down and uncheck extended-inserts


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

    0 讨论(0)
提交回复
热议问题