Reputation: 638
I have a database backup with 400+ sql files. foreach table there is a separate sql file. Is it possible to import all this files together to a database? If so could you tell me how to do this?
Also the backup is a gzipped tar file. Is there a way to restore from a compressed file.?
Upvotes: 6
Views: 10519
Reputation: 447
Or, with pv installed, you can see also the progress by using:
pv -p *.sql | mysql database
Upvotes: 0
Reputation: 31
Nowdays processors have many cores. To use all the cores:
for s in *.sql.gz ; do gunzip -c $s | mysql -u sql_user -p'password' database_name & done
This command opens background process for each sql-dump file.
Upvotes: 1
Reputation: 4601
If you are using linux Concatenate all the sql files using and
cat *.sql > fullBackup.sql
then you can restore the database using this backup file
Upvotes: 9
Reputation: 638
I have found the answer for my question here. Import Multiple .sql dump files into mysql database from shell
find . -name '*.sql' | awk '{ print "source",$0 }' | mysql --batch
works perfectly. Thanks for @Haim to pointing out the correct post.
Upvotes: 3