Is there a way via console to dump all tables of a database one by one? I want only to import some of them in staging area and some local but not export most of the tables twice (I need once 70% and once 80% of the database).
1 Answer
mydumper does this by default. It writes two files for every table dumped:
- database.table.sql(.gz)
- database.table-schema.sql(.gz)
Where database and table are the names of your database and each table.
If you want to do this with mysqldump, it's awkward. Possible solutions:
- Use mysqldump with the
--tablesoption to specify a subset of tables. - Use the
--taboption to dump CSV files, one per table. - Use
sedorperlor some other text filtering tool to separate the tables you want from your single dump file.
1 Comment
Isengo
Too bad - our hoster will not allow non-ubuntu core repos. Maybe a nice touch for local setups. Export of 1.6GB DB in 7s and import in 5min. Pretty fast.
INFORMATION_SCHEMA.TABLES, then dump each to its own file.LIKEto get a list of table, then dump them all into one .sql file.