您好,登錄后才能下訂單哦!
小編給大家分享一下便于管理mysql的shell腳本有哪些,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!
[mysql@clark scripts]$ ls
mysql_db_shutdown.sh mysql_db_startup.sh mysql_env.ini mysqlplus.sh
[mysql@clark scripts]$ more mysql_db_shutdown.sh
#/bin/sh
#Created by clark 20170918
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} -S /data/mysqldata/${HOST_PORT}/mysql.sock shutdown
[mysql@clark scripts]$
[mysql@clark scripts]$
[mysql@clark scripts]$ more mysql_db_startup.sh
#/bin/sh
#Created by clark 20170918
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 &
[mysql@clark scripts]$
[mysql@clark scripts]$
[mysql@clark scripts]$ more mysql_env.ini
#set env
MYSQL_USER=system
MYSQL_PASS='welcome123'
#check parameter
if [ $# -ne 1 ]
then
HOST_PORT=3306
else
HOST_PORT=$1
fi
[mysql@clark scripts]$
[mysql@clark scripts]$ more mysqlplus.sh
#/bin/sh
#Created by clark 20170918
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} -S /data/mysqldata/${HOST_PORT}/mysql.sock
以上是“便于管理mysql的shell腳本有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。