The first step is to see the maximum number of connections under current MySQL
The code is as follows |
Copy Code |
[Root@localhost ~]#/usr/local/mysql/bin/mysqladmin-uroot-ppassword variables |grep max_connections |
(Note that root is replaced with your database, but the general default is Root,password is the database password,) Enter the above command will display the following information, this is the maximum number of connections is 100
The code is as follows |
Copy Code |
| max_connections | 100//default is 100
|
Part II, modify the maximum number of connections to 200
The code is as follows |
Copy Code |
[Root@localhost ~]# nano/etc/my.cnf |
Enter the contents of the My.cnf file after entering the above command and add the following line of code
The code is as follows |
Copy Code |
max_connections=200 |
Use up and down arrows to move the cursor, input and then press Ctrl+o after the key to save, save the time to press ENTER again to determine, this place is also I began not to pay attention to the place, determined after pressing ctrl+x key to exit back to the command line
The last step is to restart MySQL.
The code is as follows |
Copy Code |
[root@localhost ~]# Service mysqld restart//restart MySQL command |
below is my own CentOS under the test pass
View the maximum number of connections to MySQL settings under the current system
The code is as follows |
Copy Code |
1 [root@localhost ~]#/usr/bin/mysqladmin-uroot-p variables |grep max_connections | max_connections | 100//default is 100 1 [root@localhost ~]# nano/etc/my.cnf Edit my.cnf by adding in [Mysqld]: 1 set-variable=max_connections=1000 1 [root@localhost ~]# service mysqld restart//restart MySQL |
Small hint, and not your MySQL concurrent number set the larger the better, we need to according to their own server and the status of the site to adjust the number of concurrent sites.