修改mysql預設最大串連數樣本

來源:互聯網
上載者:User

查看mysql最大串連資料

 代碼如下 複製代碼

show variables like '%max_connections%'

修改方法:

進入mysql終端,

 代碼如下 複製代碼

mysql > set GLOBAL max_connections=1000;
mysq > show variables like '%max_connections%';

當然,你也可以直接修改mysql設定檔。進入MySQL安裝目錄 開啟MySQL設定檔 my.ini 或 my.cnf尋找 max_connections=100 修改為 max_connections=1000 服務裡重起MySQL即可。
注意:MySQL伺服器允許的最大串連數16384


另一種在linux系統中的方法


以centos 4.4 下面的mysql 5.0.33 手工編譯版本為例說明:

 代碼如下 複製代碼

vi /usr/local/mysql/bin/mysqld_safe

找到safe_mysqld編輯它,找到mysqld啟動的那兩行,在後面加上參數 :

 代碼如下 複製代碼

-O max_connections=1500

具體一點就是下面的位置:

 代碼如下 複製代碼

then $NOHUP_NICENESS $ledir/$MYSQLD

$defaults --basedir=$MY_BASEDIR_VERSION

--datadir=$DATADIR $USER_OPTION

--pid-file=$pid_file

--skip-external-locking

-O max_connections=1500

>> $err_log 2>&1 else

eval "$NOHUP_NICENESS $ledir/$MYSQLD

$defaults --basedir=$MY_BASEDIR_VERSION

--datadir=$DATADIR $USER_OPTION

--pid-file=$pid_file

--skip-external-locking $args

-O max_connections=1500 >>

$err_log 2>&1"

儲存。

 代碼如下 複製代碼

# service mysqld restart

# /usr/local/mysql/bin/mysqladmin -uroot -p variables

輸入root資料庫帳號的密碼後可看到

max_connections 1500 即新改動已經生效。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.