Created
February 24, 2011 22:34
-
-
Save gagarine/843044 to your computer and use it in GitHub Desktop.
Import multiple sql file in a mysql database
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
db=$1 | |
user=$2 | |
passwd=$3 | |
if [ "$db" = "" ]; then | |
echo "Usage: $0 db_name user password" | |
exit 1 | |
fi | |
clear | |
for sql_file in *.sql; do | |
echo "Importing $sql_file"; | |
mysql5 --user=$user --password=$passwd $db< $sql_file; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
you need replace mysql5 by mysql and it's ok now :)
thx for your bash