1. 程式人生 > >mysql---連線數太多 (1040 too many connection),調大連線

mysql---連線數太多 (1040 too many connection),調大連線

貴州專案mysql資料庫連線太多---1040 too many connection


計劃調一下最大連線數。

方法1:(命令修改)

1)登入mysql:mysql -u root -p  輸入密碼,回車

執行以下語句修改最大連線數:set global max_connections = 3600; VARIABLE_NAME='MAX_CONNECTIONS';

2)登入成功後執行以下語句查詢當前的最大連線數:select VARIABLE_VALUE from information_schema.GLOBAL_VARIABLES where VARIABLE_NAME='MAX_CONNECTIONS';

3)執行以下語句修改最大連線數:set global max_connections = 800;

問題:

但是3)遇到了ERROR 1227 (42000): Access denied; you need (at least one of) the PROCESS privilege(s) for this ....

解決辦法:

嘗試在配置檔案my.cnf(linux環境下)跳過許可權。

 在[mysqld]段中加入 skip-grant-tables儲存之後,重啟mysql服務。

再進行之前上述操作,可以執行成功。 


但是重啟後沒有修改成功。(圖中 0 rows affected已經說明了問題。)


--------------------------------------------------------------------------------------------------------------------

方法二:

直接在配置檔案my.cnf中新增(修改)max_connections的配置


重啟後,檢視。修改成功。 ok.