Skip to content

Instantly share code, notes, and snippets.

@gagarine
Created February 24, 2011 22:34
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save gagarine/843044 to your computer and use it in GitHub Desktop.
Save gagarine/843044 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
@legende91
Copy link

Hello,
you need replace mysql5 by mysql and it's ok now :)

thx for your bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment