After MySQL is installed, there are many parameters that need tuning. Almost all of the content involved in tuning can be set up in the My.cnf file. The number of MySQL connections is also one of the more important tuning parameters. MySQL's default maximum connection number is 100, for large load of concurrent requirements is not enough, then you can modify the MySQL maximum number of connections.
1, view the current MySQL maximum number of connections method:
Mysqladmin-uroot-ppassword Variables | grep max_connections
Or
Mysql> show GLOBAL VARIABLES WHERE variable_name= ' max_connections ';
Or
Mysql> show GLOBAL like '%conn% ';
I personally prefer to use the last method to view, because I always remember not full connections the word. Oh......
2, the modification method has
mysql> SET GLOBAL max_connections=1000;
Changes will take effect immediately, do not need to restart the MySQL service, but will fail after reboot.
Modify/ETC/MY.CNF,
Add under [mysqld]:
max_connections=1000
You will need to restart the MySQL service before you can make the changes again.
3: The modification method has
Client Login Mysql:mysql-uusername-ppassword
Set the new maximum number of MySQL connections for 1000:mysql> set GLOBAL max_connections=1000;
Displays the currently running query:mysql> show processlist;
Display current status:mysql> show status;
Exit client:mysql> exit;
View current maximum number of MySQL connections: Mysqladmin-uusername-ppassword variables;
The following two commands can be used to query the maximum number of connections and the number of connected connections:
Show variables like ' max_connections '; #查看最大连接数 (default 100).
Show global status like ' Xax_used_connections '; #查看最大使用量