max_connections = 100ERROR 1040: Too many connectionswhereis safe_mysqldsafe_mysqld,找到 mysqld 啟動行 (兩處:無參數與帶參數)-O max_connections=1000--- safe_mysqld.orig
+++ safe_mysqld
@@ -109,10 +109,10 @@
if test "$#" -eq 0
then
nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \
- --skip-locking >> $err_log 2>&1
+ --skip-locking -O max_connections=1000 >> $err_log 2>&1
else
nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \
- --skip-locking "$@" >> $err_log 2>&1
+ --skip-locking "$@" -O max_connections=1000 >> $err_log 2>&1
fi
mysqladmin -u root -p variables | grep max_connections
# 輸出: max_connections 1000
直接在 my.cnf [mysqld] 區段設定:
[mysqld]
max_connections = 1000
# 相關參數同步調大
max_user_connections = 800
wait_timeout = 300
interactive_timeout = 300
修改後 service mysql restart 即可,無需動啟動腳本。