共計 1063 個字符,預(yù)計需要花費(fèi) 3 分鐘才能閱讀完成。
自動寫代碼機(jī)器人,免費(fèi)開通
本篇文章為大家展示了 MYSQL 中怎么調(diào)整最大連接數(shù),內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。
如何加大 MYSQL 中的最大連接數(shù)
1. 修改 safe_mysqld
找到 safe_mysqld 編輯它,找到 mysqld 啟動的那兩行,在后面加上參數(shù):
-Omax_connections=1000
例如:(其中前面有 — 的是原來的內(nèi)容,而 +++ 是修改過以后的)
—safe_mysqld.origMonSep2509:34:012000
+++safe_mysqldSunSep2416:56:462000
@@-109,10+109,10@@
iftest $# -eq0
then
nohup$ledir/mysqld–basedir=$MY_BASEDIR_VERSION–datadir=$DATADIR
—skip-locking $err_log2 1
+–skip-locking-Omax_connections=1000 $err_log2 1
else
nohup$ledir/mysqld–basedir=$MY_BASEDIR_VERSION–datadir=$DATADIR
—skip-locking $@ $err_log2 1
+–skip-locking $@ -Omax_connections=1000 $err_log2 1
fi
iftest!-f$pid_file#Thisisremovedifnormalshutdown
then
然后關(guān)閉 mysql 重啟它,用
/mysqladmin 所在路徑 /mysqladmin-uroot-pvariables
輸入 root 數(shù)據(jù)庫賬號的密碼后可看到
|max_connections|1000|
即新改動已經(jīng)生效。
如何加大 MYSQL 中的最大連接數(shù)
2. 修改原代碼
解開 MySQL 的原代碼,進(jìn)入里面的 sql 目錄修改 mysqld.cc 找到下面一行:
{max_connections ,(long*) max_connections,100,1,16384,0,1},
把它改為:
{max_connections ,(long*) max_connections,1000,1,16384,0,1},
存盤退出,然后./configure;make;makeinstall 可以獲得同樣的效果。
上述內(nèi)容就是 MYSQL 中怎么調(diào)整最大連接數(shù),你們學(xué)到知識或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識儲備,歡迎關(guān)注丸趣 TV 行業(yè)資訊頻道。
向 AI 問一下細(xì)節(jié)