假設(shè)你的啟動腳本是/etc/init.d/mysql
那么找到$bindir/safe_mysqld這行,加上如下參數(shù)
-O max_connections=1000 -O wait_timeout=500 -O interactive_timeout=500
當(dāng)然,得根據(jù)你的實(shí)際情況加以修改,不過默認(rèn)值對于我們公司這樣負(fù)載的服務(wù)器是不可想象的……
現(xiàn)在,你的MySQL啟動文件有可能看起來像這樣:
............
$bindir/safe_mysqld --user=mysql --datadir=$datadir --pid-file=$pid_file -O max_connections=1000 -O wait_timeout=500 -O interactive_timeout=500&
............
修改完成之后,重啟MySQL即可,注意一定要先使用mysqladmin shutdown 服務(wù)器。
推薦在my.cnf中配置這些參數(shù)。
如果你有MySQL的源代碼版本,你可以在support-files目錄下找到my-huge.cnf, my-large.cnf
分別打開看看,選擇適合你的那個文件
抄一段話:
# You can copy this file to # /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options (in this # installation this directory is @localstatedir@) or # ~/.my.cnf to set user-specific options. # # One can in this file use all long options that the program supports. # If you want to know which options a program support, run the program # with --help option.
建議加入精華:)
|