• 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     then
    25         echo "create database ${DBNAME} failed..."
    26         exit 1
    27     else
    28         echo "succeed to create database ${DBNAME}"
    29     fi
    30 }
    31 
    32 
    33 create_database
  • 相关阅读:
    vue day6 分页显示
    vue day5 分页控件
    vue day4 table
    c# excel xlsx 保存
    diff算法
    Web Workers
    多线程
    Http请求优化
    高效编写代码
    渲染引擎
  • 原文地址:https://www.cnblogs.com/zhengze/p/14050304.html
Copyright © 2020-2023  润新知