6

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.?

2
  • 1
    stackoverflow.com/questions/4708013/… Commented Jan 25, 2012 at 8:41
  • 1
    @Haim, thanks for pointing me the right post. I like the find method with awk script. It works perfectly. Many Thanks. Commented Jan 25, 2012 at 9:08

4 Answers 4

10

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

Sign up to request clarification or add additional context in comments.

Comments

3

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.

Comments

1

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.

Comments

0

Or, with pv installed, you can see also the progress by using:

pv -p *.sql | mysql database 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.