mysql "too many connections" 毛病 之 mysql處理辦法。本站提示廣大學習愛好者:(mysql "too many connections" 毛病 之 mysql處理辦法)文章只能為提供參考,不一定能成為您想要的結果。以下是mysql "too many connections" 毛病 之 mysql處理辦法正文
處理辦法是修正/etc/mysql/my.cnf,添加以下一行:
set-variable = max_connections=500
或在啟動敕令中加上參數 max_connections=500
就是修正最年夜銜接數,然後重啟mysql.默許的銜接數是100,太少了,所以輕易湧現如題毛病.
以下是mysql.com網站的相干解釋:
If you get a Too many connections error when you try to connect to the mysqld server, this means that all available connections are in use by other clients.
The number of connections allowed is controlled by the max_connections system variable. Its default value is 100. If you need to support more connections, you should restart mysqld with a larger value for this variable.
mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the SUPER privilege. By granting the SUPER privilege to administrators and not to normal users (who should not need it), an administrator can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected. See Section 13.5.4.19, “SHOW PROCESSLIST Syntax”.
The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform. Linux or Solaris should be able to support 500-1000 simultaneous connections, depending on how much RAM you have and what your clients are doing. Static Linux binaries provided by MySQL AB can support up to 4000 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"
緣由:
由於你的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的成績
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
再開啟選項,勝利啟動。