1135 error resolution for MySQL

Source: Internet
Author: User
Tags thread

MySQL's 1135 error message is as follows:

SQLSTATE[HY000] [1135] Can ' t create a new thread (errno 12); If you are are not out of available memory, you can consult the manual for a possible bug

Solution:

Modify My.ini to add 2 parameters:

Innodb_thread_sleep_delay=40

wait_timeout=100

interactive_timeout=100

Restart the MySQL server

The main problem is that there are too many threads:

1. Too many connections

2. The lifecycle allowed for each thread is too long, as is the case with HTTP timeout.

The way to check the number of connections under Linux is as follows:

Ps-aux | grep MySQL

"Supplementary Knowledge" ================================

Configuration parameters in MySQL interactive_timeout and wait_timeout

(1) Interactive_timeout:

Parameter meaning: The number of seconds the server waits for activity before shutting down an interactive connection. An interactive client is defined as a client that uses the Client_interactive option in Mysql_real_connect ().

Parameter default value: 28,800 seconds (8 hours)

(2) Wait_timeout:

Parameter meaning: The number of seconds the server waits for activity before it closes a non-interactive connection.

When a thread starts, the session Wait_timeout value is initialized based on the global Wait_timeout value or global interactive_timeout value, depending on the client type (by the connection option of the Mysql_real_connect () Client_ Interactive definition).

Parameter default value: 28,800 seconds (8 hours)

The maximum number of connections supported by the MySQL server is capped because each connection is built to consume memory, so we want the client to disconnect and free up memory after it has been connected to MySQL server to handle the appropriate operation. If your MySQL server has a large number of idle connections, they will not only consume memory, but if the connection has been accumulating and constantly open, it will eventually reach the MySQL server connection limit, which will report ' Too many connections ' error. For the Wait_timeout value setting, it should be judged according to the operation of the system. After the system has been running for a while, you can view the current system's connection status through the show Processlist command, and if you find a connection process with a large number of sleep states, this parameter is set too large and can be adjusted less appropriately.

Problem:

If only the parameter wait_timeout=100 is set in the profile my.cnf, the server is restarted and entered, executing:

Mysql> Show variables like "%timeout%";

You will find that the parameter settings are not in effect, still 28800 (that is, the default 8 hours).

After querying the data, you must set up Interactive_timeout and wait_timeout to be effective.

"Mysqld"

wait_timeout=100

interactive_timeout=100

After restarting MySQL server entry, the view settings are in effect.

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.