解決mysql 1040錯誤Too many connections的方法

來源:互聯網
上載者:User

標籤:

解決mysql 1040錯誤Too many connections的方法

 

1.可能是mysql的max connections設定的問題

2.可能是多次insert,update操作沒有關閉session,需要在spring裡配置transaction支援。

 

解決:

1.修改tomcat裡的session 的time-out時間減少為20,(不是必改項)

2.對處理量大的對資料庫insert或update的操作提供transaction支援.

 

=======================================
 

下面的是解決辦法:

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"

原因:  www.2cto.com  

因為你的mysql安裝目錄下的my.ini中設定的並發串連數太少或者系統繁忙導致串連數被佔滿

 

解決方式:

開啟MYSQL安裝目錄開啟MY.INI找到max_connections(在大約第93行)預設是100 一般設定到500~1000比較合適,重啟mysql,這樣1040錯誤就解決啦。

max_connections=1000

一定要重新啟動MYSQL才會生效

CMD->

net stop mysql

net start mysql

 

關於改變innodb_log_file_size後無法啟動mysql的問題

   www.2cto.com  

innodb_buffer_pool_size=768M

innodb_log_file_size=256M

innodb_log_buffer_size=8M

innodb_additional_mem_pool_size=4M

innodb_flush_log_at_trx_commit=0

innodb_thread_concurrency=20

以上是對innodb引擎的初步最佳化, 發現是更新innodb_log_file_size=256M時候出現了問題,只要加上這個就無法啟動,

 

後來才知道原來要STOP服務先,然後再刪除原來的檔案………

開啟/MySQL Server 5.5/data

刪除ib_logfile0, ib_logfile1........ib_logfilen

再開啟選項,成功啟動。


解決mysql 1040錯誤Too many connections的方法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.