How to view the current number of MySQL connections in real time

Source: Internet
Author: User
Tags mysql client

How do I see the current number of MySQL connections in real time?How to view the current number of MySQL connections in real time?1, view the details of all current connections:./mysqladmin-uadmin-p-h10.140.1.1processlist2, view only the current number of connections (threads is the number of connections):./mysqladmin-uadmin-p-h10.140.1.1status, 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 | localhost3544| BBS | Sleep | -| | ||701| Root | localhost3761| | Uery |0| | Show Processlist |+-----+------+----------------+---------+---------+------+-------+------------------+2, view only the current number of connections (threads is the number of connections.): Mysqladmin-uroot-Proot Statusd:\mysql\bin>mysqladmin-uroot-proot statusuptime:2102Threads:3Questions:15531Slow Queries:0Opens:0Flush tables:1Open tables: AQueries per second avg:7.3893, modify MySQL maximum connection number: Open My.ini, modify Max_connections= -(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, use the status command to get the number of thread connections and the ID of the current connection, or use show full processlist to see all the connection processes, Note Review the process wait time and whether the state is locked if there are too many processes, print the process and view the MySQL-E'show full processlist;'>111finding non-locked processes is generally the reason for the current execution of the card, which causes 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= +Save and restart the MySQL (and PHP collocation best combination) service. Then use the command: MySQL (and PHP collocation of the best combination) Admin-uroot-p Variables Enter the password of the root database account to see| max_connections | +|view MySQL connections and current user MySQL connections enter the MySQL prompt as administrator first. #mysql-uroot-Pxxxxmysql>Show processlist; can display the first 100 connection information show full processlist; 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= -This is the number of single-user connectionsSet-variable=max_connections= -This is the global limit number of connections

How to view the current number of MySQL connections in real time

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.