com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establish

最簡單的辦法是由於你的my.ini中設定的併發鏈接數太少或者系統繁忙致使鏈接數被佔滿解決方式:打開MySQL安裝目錄打開MY.INI找到max_connections默認是100 .
-
-
實例php

WINDOWS解決mysql Errno.: 1040錯誤
XXXX info: Can not connect to MySQL serverjava

User: root
Time: 2004-5-20 3:00pm
Script: /XXXX/XXXX.PHPmysql

Error: Too many connections
Errno.: 1040spring

An error report has been dispatched to our administrator.sql


上面錯誤觀點提示數據庫


1.多是mysql的max connections設置的問題
2.多是屢次insert,update操做沒有關閉session,須要在spring裏配置transaction支持。tomcat

解決:
1.修改tomcat裏的session 的time-out時間減小爲20,(不是必改項)
2.對處理量大的對數據庫insert或update的操做提供transaction支持.session

=======================================
下面的是解決辦法:併發

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
再開啓選項,成功啓動。


高手優化的MYSQL my.ini的1000人在線配置。

#This File was made using the WinMySQLAdmin 1.4 Tool #2004-2-23 16:28:14 #Uncomment or Add only the keys that you know how works. #Read the MySQL Manual for instructions [mysqld] basedir=D:/mysql #bind-address=210.5.*.* datadir=D:/mysql/data #language=D:/mysql/share/your language directory #slow query log#= #tmpdir#= #port=3306 set-variable = max_connections=1500 skip-locking #skip-networking set-variable = key_buffer=384M set-variable = max_allowed_packet=1M set-variable = table_cache=512 set-variable = sort_buffer=2M set-variable = record_buffer=2M set-variable = thread_cache=8 # Try number of CPU's*2 for thread_concurrency set-variable = thread_concurrency=8 set-variable = myisam_sort_buffer_size=64M #set-variable = connect_timeout=5 #set-variable = wait_timeout=5 server-id = 1 [isamchk] set-variable = key_buffer=128M set-variable = sort_buffer=128M set-variable = read_buffer=2M set-variable = write_buffer=2M [myisamchk] set-variable = key_buffer=128M set-variable = sort_buffer=128M set-variable = read_buffer=2M set-variable = write_buffer=2M [WinMySQLadmin] Server=D:/mysql/bin/mysqld-nt.exe

相關文章
相關標籤/搜索