Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save guillermomartinez/0362500d2a73b83d6917bc73c2a7a62f to your computer and use it in GitHub Desktop.
Save guillermomartinez/0362500d2a73b83d6917bc73c2a7a62f to your computer and use it in GitHub Desktop.
Import multiple sql file in a mysql database
#!/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