Skip to content

Instantly share code, notes, and snippets.

@TGM
Forked from gagarine/mysql_multiple_import.bash
Created October 14, 2012 10:24
Show Gist options
  • Save TGM/3888188 to your computer and use it in GitHub Desktop.
Save TGM/3888188 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