How to import data (Inserts) to a model (.MWB) in the Workbench?

Asked

Viewed 765 times

1

In Workbench I can enter data in the model individually by table as below, then when using the forward Engineer just enable Create Inserts in the SQL file it generates, follows:

inserir a descrição da imagem aqui

But to do this for hundreds of tables is very expensive (export from the server to CSV and then import, one by one), my question is, is there a way to import data from a mysql server to a Workbench model? in case it would be the same model physically that is on the server.

1 answer

1

It is possible to dump your database by Workbench you have to click with the right button on the base and ask to export but this process is time consuming.

I recommend using command line: You told q the table structure is ok, then it would just be the data then on the server in the shell command if it is Ubuntu you put this command

mysqldump -h localhost -u user -ppassword --no-create-info banco > minhabase.sql

if you want the query to create the tables and etc would be:

mysqldump -h localhost -u user -ppassword banco > minhabase.sql

To restore you do so

mysql -h localhost -u user -ppassword banco < minhabase.sql

To do these commands in windows, one must enter the MSDOS "Ctrl+R -> 'cmd' enter" Navigate to where your mysql is, enter the bin folder. Ready now you can do the commands.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.