MySQL: Importing/Exporting a database
To export & import MySQL databases we recommend using the MySQL Workbench tool, which will connnect to the database using an external connection.
Importing a database from a file
To import a file, open Workbench and click on + next to the MySQL connections option. Fill in the fields with the connection information.
Once connected to the database go to Data Import/Restauration. Choose the option Import from Self-Contained File and select the file.
Depois, escolha para qual banco de dados este arquivo será importado em Default Schema to be Imported To. Clique em Start Import.
Once the import is completed, you can see all the available tables:
Exporting into a File
To export into a file, open up Workbench and click on + next to the MySQL connections option. Fill in the fields with the connection information..
Once connected to the database, under Management, choose Data Export. Select the files to be exported and the configuration:
Dump data and Structure: this means that the data as well as the structure of the database will be recorded.
Export to Self-Contained File: the database will be exported into a new file.
Now click on Start Export.
A .sql willl be created on your local computer with all the data, its contet should be something similar to this:
In order for the connection to be successful, the Allow external connections option should be enabled.