#!/bin/sh
if [ "$1" == "" -a "$2" == "" ];then
echo "请输入一个新建库名"
exit 1
fi
#if [ "$1" == "" -a "$2" == "" ];then
# echo "Usage: $0 DATABAS_ENAME DATABASE_PASS"
# exit 1
#fi
/usr/local/mysql/bin/mysql -uroot -pjt123@ <<EOF
create database $1;
GRANT all ON $1.* TO "$1"@localhost IDENTIFIED BY '$2';
flush privileges;
EOF
echo "数据库是$1"
echo "数据库用户名是$1"
echo "数据库地址是localhost"
echo "数据库密码是$2"