CentOS under test pass
View the maximum number of connections to MySQL settings under the current system
| The code is as follows |
Copy Code |
[Root@localhost ~]#/usr/bin/mysqladmin-uroot-p variables |grep max_connections | max_connections | 100//default is 100 |
or view directly in MySQL command mode
| The code is as follows |
Copy Code |
Mysql> Show variables like ' max_connections '; |
This command will result in output similar to the following:
+-----------------+-------+
| variable_name | Value |
+-----------------+-------+
| max_connections | 2000 |
+-----------------+-------+
1 row in Set (0.00 sec)
Start editing the my.cnf file now
| The code is as follows |
Copy Code |
[Root@localhost ~]# nano/etc/my.cnf Edit my.cnf by adding in [Mysqld]: set-variable=max_connections=1000 [root@localhost ~]# Service mysqld restart//restart MySQL |
Another method can be directly in the command mode
The maximum number of connections for MySQL default is 100 client login: Mysql-uusername-ppassword
Set the new maximum number of connections to 200:mysql> set GLOBAL max_connections=200;
Displays the currently running query:mysql> show processlist;
Display current status:mysql> show status;
Exit Client:mysql> Exit
Summarize
Method Two to restart the server or MySQL to restore the previous state, the method is a long time to enter into effect oh.