I want to import a number (over 100) .sql files into a single database. I can do this for one
mysql -u root -p db_name < /tmp/export/data.sql
But I have a lot, so I tried this but it fails stating "ambiguous redirect"
mysql -u root -p db_name < /tmp/export/*
Is there another approach I can use from the command line to do this?
Select File, then Import, then File. Click Multiple Files. Select the files you want to import. Browse for the first file.
Try:
find . -name '*.sql' | awk '{ print "source",$0 }' | mysql --batch -u root -p db_name
I would try something like
cat * | mysql -u root -p db_name
Maybe trying
mysql -u root -p db_name < /tmp/export/*.sql
would be an effective alternative.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With