Mysqlエラーtoo many connectionsソリューション

2925 ワード

Mysqlエラーtoo many connections、最近このエラーに遭遇して、インターネットを通じて資料を調べて解決して、ここで記録して、必要な友达を助けて、
解決策は/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操作はセッションを閉じていません.springでtransactionサポートを構成する必要があります.
解決:
1.tomcatのセッションを変更する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=256 Mで問題が発生し、これを加えると起動できなくなり、
あとでSTOPサービスが先だと分かってから、元のファイルを削除して・・・
開く/MySQL Server 5.5/data
ib_を削除logfile0, ib_logfile1........ib_logfilen
オプションを再起動し、正常に起動しました.
読書に感謝して、みんなを助けることができることを望んで、みんなの当駅に対する支持に感謝します!