MySQL单实例或多实例启动脚本 – Mysql笔记 – CFEI.NET
今天我们继续来讲Mysql方面的知识。
1. [root@zyl scripts]# cat mysqld01.sh 2. #!/bin/bash3. 4. . /etc/init.d/functions5. user=root6. pass=8888887. path="/application/mysql/bin"8. function usage(){9. echo "Usage:$0{start|stop|restart|}"10. exit111. }12. [ $# -ne 1 ]&& usage13. function start_db(){14. $path/mysqld_safe--user=$user >/dev/null &15. if [ $? -eq 0 ];then16. action"starting MySQL..." /bin/true17. else18. action"start MySQL..." /bin/false19. fi20. } 21. function stop_db(){22. $path/mysqladmin-u$user -p$pass shutdown &>/dev/null 23. if [ $? -eq 0 ];then 24. action"stoping MySQL..." /bin/true25. else26. action"stop MySQL..." /bin/false27. fi28. } 29. if [ "$1" == "start"];then30. start_db31. elif [ "$1" == "stop"];then32. stop_db33. elif [ "$1" == "restart"];then34. stop_db35. sleep336. start_db37. else38. usage39. fi
本文出自 “randolph” 博客,转载请与作者联系!
因为水平有限,难免有疏忽或者不准确的地方,希望大家能够直接指出来,我会及时改正。一切为了知识的分享。
后续会有更多的精彩的内容分享给大家。