i have 10+ tables, i want to export them to another datebase. how could i do that? i tried select * from table_a, table_b into ourfile "/tmp/tmp.data", but it joined the two tables.
MySQL workbench tool can be used to export the data from the table. Open the MySQL database wizard & select the table you want to export. Right-click on the table name & select the table data export wizard option.
It's probably too late, but for the record:
Export an entire database:
mysqldump -u user -p database_name > filename.sql
Export only one table of the database:
mysqldump -u user -p database_name table_name > filename.sql
Export multiple tables of the database
Just like exporting one table, but keep on writing table names after the first table name (with one space between each name). Example exporting 3 tables:
mysqldump -u user -p database_name table_1 table_2 table_3 > filename.sql
Notes:
The tables are exported (i.e. written in the file) in the order in which they are written down in the command.
All of the examples above export the structure and the data of the database or table. To export only the structure, use no-data
. Example exporting only one table of the database, but with no-data:
mysqldump -u user -p --no-data database_name table_name > filename.sql
Export mysqldump -u user -p mydatabasename > filename.sql
Import mysql -u user -p anotherdatabase < filename.sql
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With