How do I see the current number of MySQL connections in real time? 1, view details of all current connections:./mysqladmin -uadmin -p -h10.140.1.1 processlist2, View only the current number of connections (threads is the number of connections):./mysqladmin -uadmin -p -h10.140.1.1 status, view details of all current connections: mysqladmin -uroot -proot processlistd:\mysql\bin>mysqladmin -uroot -proot processlist+-----+------+----------------+---------+---------+------+-------+------------------+| id | User | Host | db | Command | Time | State | info |+-----+------+----------------+---------+---------+------+-------+------------------+| 591 | root | localhost:3544 | bbs | sleep | 25 | | | | 701 | root | localhost:3761 | | uery | 0 | | show processlist |+-----+------+----------------+---------+---------+------+-------+---------- --------+ 2, view only current connectionNumber (threads is the number of connections.): mysqladmin -uroot -proot statusd:\mysql\bin>mysqladmin -uroot - Proot statusuptime: 2102 threads: 3 questions: 15531 slow queries: 0 opens: 0 flush tables: 1 open tables: 61 queries per second avg: 7.3893, modify MySQL maximum connection number: Open My.ini, modify max_connections=100 (default is 100). Today there is a MySQL server with a sudden increase in connection count, and waiting for the process to be all locked ... Because the problem is not solved properly, lead to be scolded ... OTL Summary: In the future to quickly locate the error, layout solution after logging in to the MySQL client, using the status command can also get the number of thread connections and the current connection ID or with show full processlist Take a look at all the connection processes, note the process wait time and the status whether the process is locked if there are too many processes, print the processes, and then look at mysql -e ' show full processlist; ' > 111 the process of finding non-locked, which is generally the reason that the current execution is stuck, causing the subsequent process to queue. In addition, the way to modify the maximum number of MySQL connections: edit mysql (and PHP collocation of the best combination) configuration file my.cnf or my.ini in [MySQL (and PHP collocation of the best combination) d] Configuration segment added: Max_ connections = 1000 Save, restart MySQL (and PHP collocation of the best combination) service. Then use the command: MySQL (the best combination with PHP) admin -uroot -p variables Enter the password of the root database account to see | max_connections | 1000 | view MySQL connections and current user MySQL connections enter MySQL prompt as administrator first. #mysql -uroot -pxxxxmysql> show processlist; can display the first 100 connection information show full processlist; can show all. Casually, if you log in with a regular account, only the user is shown. Note that there is a semicolon after the command. If we want to view this server setting. #vi /etc/my.cnfset-variable=max_user_connections=30 This is the number of single-user connections set-variable=max_connections= 800 This is the global limit number of connections
This article is from the "Little Rookie" blog, please be sure to keep this source http://baishuchao.blog.51cto.com/12918589/1930525
How do I see the current number of MySQL connections in real time?