• ADADADADAD

    开发mysql单实例或多实例启动脚本[ mysql数据库 ]

    mysql数据库 时间:2024-12-03 10:28:44

    作者:文/会员上传

    简介:

    单实例启动:mysqld_safe --user=mysql &停止:mysqladmin -u root -proot shutdown开发脚本#!/bin/bash#chkconfig:23453050#Date:2017-6-29#Author:xcn(baishuchao@yeah.net)#

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    单实例

      启动:mysqld_safe --user=mysql &

      停止:mysqladmin -u root -proot shutdown

      开发脚本

    #!/bin/bash#chkconfig:23453050#Date:2017-6-29#Author:xcn(baishuchao@yeah.net)#versionUltimatesPID="/var/run/mysqld/mysqld.pid"user="root"#定义用户名密码pass="root"path="/usr/bin"./etc/init.d/functionsfunctionusage(){echo"$0{start|stop|restart}"exit1}[$#-ne1]&&usage#当$#号等于1则执行usage函数#start_mysqlfunctionstart_mysql(){if[!-f$PID]then$path/mysqld_safe--user=mysql&>/dev/null2>&1#一定要全路径以免出错if[$?-eq0]thenaction"startmysql"/bin/trueelseaction"startmysqlerro"/bin/falsefielseecho"mysqldisrunning"fi}#stop_mysqlfunctionstop_mysql(){$path/mysqladmin-u$user-p$passshutdown>/dev/null2>&1if[$?-eq0]thenaction"stopmysql"/bin/trueelseaction"stopmysqlerro"/bin/falsefi}#传参判断执行if["$1"=="start"]thenstart_mysqlelif["$1"=="stop"]thenstop_mysqlelif["$1"=="restart"]thenstop_mysqlstart_mysqlelse#不符合以上则打印usage函数usagefi


    开发mysql单实例或多实例启动脚本.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: mysql开发