Mysql automatically shut down the service, connection restrictions and other solutions to the problem

  
                  

Adjust the connection parameters through the mysql server program mysql Administrator.

Adjust max_connections max_updates max_questions three data to a large number, then your limited operation will not lead to the termination of the database service
in the MySQL database, if a connection is not requested for 8 hours and The operation will be automatically disconnected, resulting in some database connection-based applications, especially WEB applications. There are three ways to solve this problem:
1: modify MySQL configuration parameters
2: modify JDBC
3: modify the third-party database connection pool application Proxool.xml

method One: The name of this parameter is wait_timeout, and its default value is 28800 seconds (8 hours). The meaning is the number of seconds to wait for action on this connection before closing a connection, that is, if a connection is idle more than the number of seconds set by this option, MySQL will actively disconnect the connection.
Modify operation:
Open /etc/my.cnf under linux, add the parameters below the attribute group mysqld as follows:
[mysqld]
interactive_timeout=28800000
wait_timeout=28800000

Open my.ini under windows, add:
interactive_timeout=28800000
wait_timeout=28800000
It has been shown that there is no way to set this value to infinity, that is, permanent. So if you can't guarantee that your application must have at least one operation in the set number of seconds, then it's best to use a second method to solve the problem.

Method 2: Modify the URL of the following JDBC connection:
jdbc:mysql://hostaddress:3306/schemaname?autoReconnect=true
Add autoReconnect=true this parameter, which can solve this problem.

Method 3: Configuration file (proxool.xml):



mysql


jdbc:mysql://localhost/yourDatebase?useUnicode=true&characterEncoding=UTF-8


com.mysql.jdbc.Driver



90000

< BR>20


3


20


3


true
true


SELECT CURRENT_USER

Three, Start Menu-Run-services.msc

Find mysql service and double-click

Click Recovery tab< Br>

First failure: The default is "do not operate", changed to "restart service".

Adding a "0" to "Restart Service: ___ minutes" below means that if the service is terminated unexpectedly, it will restart immediately.

Click OK to make the settings take effect.

At this point you end the mysql-nt process in the task manager, you will find that the end can not be lost.

Copyright © Windows knowledge All Rights Reserved