How to generate the whole database script in MySQL Workbench?

后端 未结 11 937
暗喜
暗喜 2021-01-30 06:22

I want to take the whole database. Where do I find the database file?

And is there a way to write the whole database with all data to a text file (like the one in SQL Se

相关标签:
11条回答
  • 2021-01-30 07:05

    None of these worked for me. I'm using Mac OS 10.10.5 and Workbench 6.3. What worked for me is Database->Migration Wizard... Flow the steps very carefully

    0 讨论(0)
  • 2021-01-30 07:08

    Q#1: I would guess that it's somewhere on your MySQL server? Q#2: Yes, this is possible. You have to establish a connection via Server Administration. There you can clone any table or the entire database.

    This tutorial might be useful.

    EDIT

    Since the provided link is no longer active, here's a SO answer outlining the process of creating a DB backup in Workbench.

    0 讨论(0)
  • 2021-01-30 07:08

    How to generate SQL scripts for your database in Workbench

    1. In Workbench Central (the default "Home" tab) connect to your MySQL instance, opening a SQL Editor tab.
    2. Click on the SQL Editor tab and select your database from the SCHEMAS list in the Object Browser on the left.
    3. From the menu select Database > Reverse Engineer and follow the prompts. The wizard will lead you through connecting to your instance, selecting your database, and choosing the types of objects you want to reverse engineer. When you're all done, you will have at least one new tab called MySQL Model. You may also have a tab called EER Diagram which is cool but not relevant here.
    4. Click in the MySQL Model tab
    5. Select Database > Forward Engineer
    6. Follow the prompts. Many options present themselves, including Generate INSERT Scripts for Tables which allows you to script out the data contained within your tables (perfect for lookup tables).
    7. Soon you will see the generated script in front of you. At this point you can Copy to Clipboard or Save to Text File.

    The wizard will take you further, but if you just want the script you can stop here.

    A word of caution: the scripts are generated with CREATE commands. If you want ALTER you'll have to (as far as I can tell) manually change the CREATEs to ALTERs.

    This is guaranteed to work, I just did it tonight.

    0 讨论(0)
  • 2021-01-30 07:10

    In MySQL Workbench 6, commands have been repositioned as the "Server Administration" tab is gone.

    You now find the option "Data Export" under the "Management" section when you open a standard server connection.

    0 讨论(0)
  • 2021-01-30 07:10

    In the top menu of MySQL Workbench click on database and then on forward engineer. In the options menu with which you will be presented, make sure to have "generate insert statements for tables" set.

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