MySQL 常用启动,关闭,登录脚本
规范化mysql的启动,关闭,登录
1 cat mysql_env.ini
#set env MYSQL_USER=* #注意用户权限 MYSQL_PASS='****' #check paramater if [ $# -ne 1 ] then HOST_PORT=3306 else HOST_PORT=$1 fi
2 mysqlplus.sh
#!/bin/sh #create by hongquan 20140714 source /data/mysqldata/scripts/mysql_env.ini echo "login mysql service:localhost_"${HOST_PORT} /usr/local/mysql/bin/mysql -u${MYSQL_USER} -p${MYSQL_PASS} -h 127.0.0.1 -S /data/mysqldata/${HOST_PORT}/mysql.sock $2
3 mysql_db_startup.sh
#!/bin/sh #create by hongquan 20140723 source /data/mysqldata/scripts/mysql_env.ini echo "startup mysql service:localhost_"${HOST_PORT} /usr/local/mysql/bin/mysqld_safe --defaults-file=/data/mysqldata/${HOST_PORT}/my.cnf &
4 mysql_db_shutdown.sh
#!/bin/sh #create by hongquan 20140714 source /data/mysqldata/scripts/mysql_env.ini echo "shutdown mysql service:localhost_"${HOST_PORT} /usr/local/mysql/bin/mysqladmin -u${MYSQL_USER} -p${MYSQL_PASS} -h 127.0.0.1 -S /data/mysqldata/${HOST_PORT}/mysql.sock shutdown