Mysql view the number of connections, the maximum number of concurrent state, and set the number of connections

 

show variables like '% max_connections%'; see the maximum number of connections

set global max_connections = 1000 re-set the maximum number of connections

 

set-variable = max_user_connections = 30 is the number of users connected to a single
set-variable = max_connections = 800 The number of connections is to limit the overall

------------------------------------------------------------------------------------------------------------

The root account to log in, check the current connection for all users 

show full processlist; 

 

 

show status like 'Threads%';

------------------- + + ------- +
| Threads_cached | 58 |
| Threads_connected | 57 is | ### refers to the value of this open connection number
| Threads_created | 3676 |
| Threads_running |. 4 | ### this value refers to the number of active connections, this value is generally much lower than the values connected

+-------------------+-------+
 
Threads MySQL server needs to be within a reasonable range, so as to ensure a healthy MySQL server is running smoothly. Threads_created represents the number of threads created earlier, you can see by looking at Threads_created process MySQL server status.
1. mysql> show global status like 'Thread%';
2. +-------------------+-------+
3. | Variable_name | Value |
4. +-------------------+-------+
5. | Threads_cached | 46 |
6. | Threads_connected | 2 |
7. | Threads_created | 570 |
8. | Threads_running | 1 |
9. +-------------------+-------+
If we set thread_cache_size in the MySQL server configuration file, when the client disconnects, the server thread will handle this client cached a response to the next customer and not destroyed (provided that the numbers are less than the upper limit of the cache).
Threads_created represents the number of threads created before, if you find Threads_created value is too large, it indicates that the MySQL server has been created in the thread, which is more consumption of resources can be appropriately increased profile thread_cache_size value, query server
thread_cache_size配置:
1. mysql> show variables like 'thread_cache_size';
2. +-------------------+-------+
3. | Variable_name | Value |
4. +-------------------+-------+
5. | thread_cache_size | 64 |
6. +-------------------+-------+
 
 
 

Guess you like

Origin www.cnblogs.com/Fooo/p/11717647.html