MySQL 1040 error prompts too many connections solution

Source: Internet
Author: User
Tags ini mysql manual

Instance

windows resolves MySQL Errno.: 1040 Error
XXXX Info:can not connect to MySQL server

User:root
Time:2004-5-20 3:00pm
Script:/xxxx/xxxx.php

Error:too Many connections
Errno.: 1040

An error in the has been dispatched to our administrator.


above the wrong point of view hints


1. Probably the problem of MySQL max connections setup
2. It is possible that multiple insert,update operations do not close session, and need to configure transaction support in spring.

Solve:
1. Reduce the time-out time of the session in Tomcat to 20, (not required)
2. Provide transaction support for the operation of database insert or update operations with large amount of processing.

=======================================
Here's the solution:

The code is as follows Copy Code
Com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:Data Source rejected establishment of Connection, message from server: "Too many connections"

Reason:

Because the number of concurrent connections in the My.ini in your MySQL installation directory is too low or the system is busy causing the number of connections to be filled up


Solution Method:

Open the MySQL installation directory to open My.ini find Max_connections (on the 93rd line) by default is 1001-like settings to 500~1000 more appropriate, restart MySQL, so 1040 errors to solve it.
max_connections=1000

Be sure to restart MySQL to take effect

The code is as follows Copy Code

Cmd->

net stop MySQL

net start MySQL

About the problem of not starting MySQL after changing innodb_log_file_size

The code is as follows Copy Code
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

The above is the initial optimization of the InnoDB engine, found that the update innodb_log_file_size=256m when there is a problem, as long as the addition of this can not start,

Later know that the original to stop service first, and then delete the original file ...
Open/mysql Server 5.5/data

Delete Ib_logfile0, Ib_logfile1........ib_logfilen
Open the option again and start successfully.


Master optimized MySQL My.ini 1000-person online configuration.

The code is as follows Copy Code

#This File was made using the Winmysqladmin 1.4 Tool
#2004-2-23 16:28:14
#Uncomment or ADD only the keys, you know.
#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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.