- #!/bin/bash
- ###########################
- # Mysql start|stop|restart
- # Date: Nov 2008
- ###########################
- ROOT="/usr/local/webserver/mysql/bin"
- err_log="/logs/mysql_errors.log"
- mysql_username="root"
- mysql_password=""
- mysql_port="3306"
- _start(){
- printf "Starting MySQL......\n"
- $ROOT/mysqld_safe --defaults-file=/usr/local/webserver/mysql/my.cnf --log-error=/logs/mysql_errors.log &
- }
- _stop(){
- printf "Stoping MySQL......\n"
- $ROOT/mysqladmin -u${mysql_username} -p${mysql_password} -S /tmp/mysql.sock shutdown
- }
- _restart(){
- printf "Restarting MySQL......\n"
- _stop
- _start
- }
- case "$1" in
- start) _start
- ;;
- stop) _stop
- ;;
- restart) _restart
- ;;
- *) echo "Usage: `basename $0` [start|stop|restart]"
- ;;
- esac
- exit 0
启动,停止,重启,打开MySQL进程的脚本
最新推荐文章于 2022-11-01 11:34:32 发布