Midhun
Midhun

Reputation: 47

how to import multiple sql file in to same mysql database automatically using shell script

Sql file to mysql database using shell script. I have ten more .sql files. But all of the .sql files are imported into same database. The .sql files are in .gz format.

Upvotes: 0

Views: 1922

Answers (1)

poncha
poncha

Reputation: 7866

bash:

for sql_file in *.sql; do mysql db_name < $sql_file; done

(Assuming you wish to import all the sql files in the current directory)

Upvotes: 2

Related Questions