seif elsherif
seif elsherif

Reputation: 25

Mysql Import *.sql with creating the database

I have dir with a lot of .sql files. I want to import them all at once when creating the database. Is it possible without doing it one-by-one?

I already tried

mysql -u user -p Database < *.sql

but no luck.

Upvotes: 1

Views: 41

Answers (1)

Bernd Buffen
Bernd Buffen

Reputation: 15057

You can do it so:

cat *.sql | mysql -u user -p Database

OR

cat *.sql >/tmp/all.sql
mysql -u user -p Database < /tmp/all.sql
rm /tmp/all.sql

Upvotes: 1

Related Questions