centos6.5 mysql5.6 Modify the number of connections or MySQL error too many connection

Source: Internet
Author: User

One, under Windows

Modify the configuration file My.ini directly, and then restart the MySQL service.

Second, under the Linux CentOS6.5

1. Log in to MySQL:

<span style= "White-space:pre" ></span>[[email protected] ~]# mysql-u root-p
2. View the current number of connections:
<span style= "White-space:pre" ></span>mysql>  show variables like ' max_connections '; <span style = "White-space:pre" ></span>+-----------------+-------+<span style= "White-space:pre" ></span> | Variable_name   | Value |<span style= "White-space:pre" ></span>+-----------------+-------+<span style= "White-space: Pre "></span>| max_connections |   |<span style= "White-space:pre" ></span>+-----------------+-------+<span style= "White-space :p re "></span>1 row in Set (0.00 sec)
3, modify the number of connections:

<span style= "White-space:pre" ></span>mysql> set GLOBAL max_connections=1000;<span style= " White-space:pre "></span>query OK, 0 rows Affected (0.00 sec)
4. View the current number of connections:
<span></span>mysql>  Show variables like ' max_connections '; <span></span>+---------- -------+-------+<span></span>| Variable_name   | Value |<span></span>+-----------------+-------+<span></span>| max_connections |   |<span></span>+-----------------+-------+<span></span>1 row in Set (0.00 sec)
Note: This method only temporarily modifies the maximum number of connections and restores the MySQL service after restarting.

Solve the problem:

To completely solve the problem or to modify the MY.CNF configuration file, here use VI to modify, enter the command: VI/USR/MY.CNF carriage return, open the file and press "I" key to enter the editing state;

Under "[Mysqld]", add "max_connections=1000", press ESC to enter command mode, enter ": Wq" carriage return (save and exit).

Execute: Service MySQL restart restart MySQL services;

Note: Many articles refer to adding "set-variable=max_connections=" under "[Mysqld]", not at all, after adding the service will not start.

Note:
1, although the 1000 written here. But the actual MySQL server allowed the maximum number of connections 16384;
2, in addition to Max_connections, the above other configuration should be based on your system needs to be configured, do not have to rigidly;
3, add the maximum allowable number of connections, the system consumption increase is not small.
4. If your MySQL is using My.ini as the configuration file, the settings are similar, but the format of the settings to be slightly flexible.
5, in the Windows system max_connections connection data need to be set according to their own machine performance, not the bigger the better.



centos6.5 mysql5.6 Modify the number of connections or MySQL error too many connection

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.