程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> 雙 MySQL 啟動、停止腳本,mysql啟動停止腳本

雙 MySQL 啟動、停止腳本,mysql啟動停止腳本

編輯:MySQL綜合教程

雙 MySQL 啟動、停止腳本,mysql啟動停止腳本


5.5 啟動

#!/bin/bash
# author: Wang Xiaoqiang
# func: Start MySQL 5.5

pid=`netstat -lnpt | awk -F '[ /]+' '/3306/ {print $7}'`

[ ! -z $pid ] && echo -e "\e[1;31mMySQL 5.5 Is Running...\e[0m" && exit 0

/usr/local/mysql5/bin/mysqld_safe --defaults-file=/etc/my.cnf >/dev/null 2>&1 &

[ $? -eq 0 ] && echo -e "\e[1;32mMySQL 5.5 Start Success.\e[0m" || echo -e "\e[1;31mMySQL 5.5 Start Failed.\e[0m"

# End

5.6 啟動

#!/bin/bash
# author: Wang Xiaoqiang
# func: Start MySQL 5.6

pid=`netstat -lnpt | awk -F '[ /]+' '/3307/ {print $7}'`

[ ! -z $pid ] && echo -e "\e[1;31mMySQL 5.6 Is Running...\e[0m" && exit 0

/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my6.cnf >/dev/null 2>&1 &

[ $? -eq 0 ] && echo -e "\e[1;32mMySQL 5.6 Start Success.\e[0m" || echo -e "\e[1;31mMySQL 5.6 Start Failed.\e[0m"

# End

5.5 停止

#!/bin/bash
# author: Wang Xiaoqiang
# func: Stop MySQL 5.5

pid=`netstat -lnpt | awk -F '[ /]+' '/3306/ {print $7}'`

[ -z $pid ] && echo -e "\e[1;31mMySQL 5.5 Is Not Running...\e[0m" && exit 0

kill $pid >/dev/null 2>&1

[ ! -z $pid ] && echo -e "\e[1;32mMySQL 5.5 Stop Success.\e[0m" || echo -e "\e[1;31mMySQL 5.5 Stop Failed.\e[0m"

# End

5.6 停止

#!/bin/bash
# author: Wang Xiaoqiang
# func: Stop MySQL 5.6

pid=`netstat -lnpt | awk -F '[ /]+' '/3307/ {print $7}'`

[ -z $pid ] && echo -e "\e[1;31mMySQL 5.6 Is Not Running...\e[0m" && exit 0

kill $pid >/dev/null 2>&1

[ ! -z $pid ] && echo -e "\e[1;32mMySQL 5.6 Stop Success.\e[0m" || echo -e "\e[1;31mMySQL 5.6 Stop Failed.\e[0m"

# End

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved