Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restoring SQL from multiple SQL files

Tags:

mysql

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

like image 752
codlib Avatar asked Dec 16 '22 04:12

codlib


2 Answers

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

like image 124
Naveen Kumar Avatar answered Jan 11 '23 00:01

Naveen Kumar


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.

like image 29
codlib Avatar answered Jan 11 '23 00:01

codlib