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