《Mysql必讀Mysql 錯誤too many connections解決方案》要點:
本文介紹了Mysql必讀Mysql 錯誤too many connections解決方案,希望對您有用。如果有疑問,可以聯(lián)系我們。
Mysql 錯誤提示too many connections,最近遇到這個錯誤,經(jīng)過上網(wǎng)查資料解決了,這里記錄下,幫助有需要的朋友,MYSQL學習
解決方法是修改/etc/mysql/my.cnf,添加以下一行:MYSQL學習
set-variable = max_connections=500MYSQL學習
或在啟動命令中加上參數(shù) max_connections=500MYSQL學習
就是修改最大連接數(shù),然后重啟mysql.默認的連接數(shù)是100,太少了,所以容易出現(xiàn)如題錯誤.MYSQL學習
以下是mysql.com網(wǎng)站的相關說明:MYSQL學習
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.MYSQL學習
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.MYSQL學習
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”.MYSQL學習
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.MYSQL學習
1.可能是mysql的max connections設置的問題MYSQL學習
2.可能是多次insert,update操作沒有關閉session,需要在spring里配置transaction支持.MYSQL學習
解決:MYSQL學習
1.修改tomcat里的session 的time-out時間減少為20,(不是必改項)MYSQL學習
2.對處理量大的對數(shù)據(jù)庫insert或update的操作提供transaction支持.MYSQL學習
=======================================MYSQL學習
下面的是解決辦法:MYSQL學習
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"MYSQL學習
原因:MYSQL學習
因為你的mysql安裝目錄下的my.ini中設定的并發(fā)連接數(shù)太少或者系統(tǒng)繁忙導致連接數(shù)被占滿MYSQL學習
解決方式:MYSQL學習
打開MYSQL安裝目錄打開MY.INI找到max_connections(在大約第93行)默認是100 一般設置到500~1000比較合適,重啟mysql,這樣1040錯誤就解決啦.MYSQL學習
max_connections=1000MYSQL學習
一定要重新啟動MYSQL才能生效MYSQL學習
CMD->MYSQL學習
net stop mysqlMYSQL學習
net start mysqlMYSQL學習
關于改變innodb_log_file_size后無法啟動mysql的問題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引擎的初步優(yōu)化, 發(fā)現(xiàn)是更新innodb_log_file_size=256M時候出現(xiàn)了問題,只要加上這個就無法啟動,MYSQL學習
后來才知道原來要STOP服務先,然后再刪除原來的文件………MYSQL學習
打開/MySQL Server 5.5/dataMYSQL學習
刪除ib_logfile0, ib_logfile1........ib_logfilenMYSQL學習
再開啟選項,成功啟動.MYSQL學習
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!MYSQL學習
轉(zhuǎn)載請注明本頁網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/3590.html