/ Published in: Bash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/sh # creates and fills mysql databases from a directory # of sql-files named like database.sql for i in `ls -1 $1`; do db_name=`echo $i|cut -d'.' -f1`; cmd="create database $db_name;"; echo will exec: $cmd; mysql -uroot -p$2 -e "$cmd"; mysql -uroot -p$2 $db_name<$1$i; done