码迷,mamicode.com
首页 > 数据库 > 详细

mysql 批量建库授权脚本

时间:2016-07-21 20:19:34      阅读:669      评论:0      收藏:0      [点我收藏+]

标签:mysql   local   

#!/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"


mysql 批量建库授权脚本

标签:mysql   local   

原文地址:http://8934920.blog.51cto.com/8924920/1828316

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!