I'm trying to dump and import some data from a MySQL (5.7) database.
Running the command
mysqldump --tab=/mysqldump mydatabase
I'm able to get a .sql
and .txt
file for each table.
How can I import all the files/tables using mysqlimport
in a single command?
I have tried mysqlimport mydatabase /mysqldump
but it does not work.
Thanks.
Best Answer
Do not use
--tab
option, use general syntaxmysqldump [options] db_name tbl_name ... > dump.sql
instead. You'll get an ordinary sql-script that can be executed via CLI-clientmysql
such way:Anyway to import different dumpfiles you have to use some shell script that build the list of files in the given directory and then proceed that list one by one like that: