2020年11月27日星期五

shell创建数据库的脚本

 1 !/bin/bash 2  3  4 HOSTNAME="localhost" 5 PORT="3306" 6 USERNAME="root" 7 PASSWORD="1234" 8 DBNAME="mydatabase" 9 10 11 LOGIN_CMD="mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD}"12 13 14 echo ${LOGIN_CMD}15 16 17 create_database() {18  echo "create database ${DBNAME}"19  create_db_sql="create database if not exists ${DBNAME} character set utf8"20  echo ${create_db_sql} | ${LOGIN_CMD}21 22 23  if [ $? -ne 0 ]24  then25   echo "create database ${DBNAME} failed..."26   exit 127  else28   echo "succeed to create database ${DBNAME}"29  fi30 }31 32 33 create_database

 









原文转载:http://www.shaoqun.com/a/493280.html

tchibo:https://www.ikjzd.com/w/1928

声网:https://www.ikjzd.com/w/2176

智赢:https://www.ikjzd.com/w/1511


1!/bin/bash234HOSTNAME="localhost"5PORT="3306"6USERNAME="root"7PASSWORD="1234"8DBNAME="mydatabase"91011LOGIN_CMD="mysql-h${HOSTNAME}-P${PORT}-u${
刘小东:刘小东
3suisses:3suisses
旺集:旺集
海外买家要发票,不会开票怎么办?亚马逊这款神器,帮你自动开票!:海外买家要发票,不会开票怎么办?亚马逊这款神器,帮你自动开票!
帕拓逊|帕拓逊新闻资讯及帕拓逊报道:帕拓逊|帕拓逊新闻资讯及帕拓逊报道

没有评论:

发表评论