Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of the method for viewing the current number of connections in mysql

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. View the details of all current connections:

. / mysqladmin-uadmin-p-h20.140.1.1 processlist2, check only the current number of connections (Threads is the number of connections.):

. / mysqladmin-uadmin-p-h20.140.1.1 status

, view the details of all current connections:

Mysqladmin-uroot-proot processlist

D:\ 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. Only check the current number of connections (Threads is the number of connections.):

Mysqladmin-uroot-proot status

D:\ MySQL\ bin > mysqladmin-uroot-proot status

Uptime: 2102 Threads: 3 Questions: 15531 Slow queries: 0 Opens: 0 Flush tab

Les: 1 Open tables: 61 Queries per second avg: 7.3893, modify the maximum number of mysql connections:

Open my.ini and modify max_connections=100 (default is 100).

Today, there is a sudden increase in the number of connections to a mysql server and waiting for all processes to be locked. He was scolded because the problem was not solved properly. OTL

Summary: in the future, we should quickly locate errors and arrange solutions.

After logging in to the mysql client, you can also get the number of thread connections and the id of the current connection by using the status command

Or use

Show full processlist

Take a look at all the connected processes, and pay attention to check the waiting time of the process and whether the state is locked.

If there are too many processes, print them out and check

Mysql-e 'show full processlist;' > 111looks for non-locked processes, which is generally the reason why the current execution is stuck and the subsequent processes are queued.

In addition, the method to modify the maximum number of connections in mysql:

Edit the MySQL (best combination with PHP) configuration file

My.cnf or my.ini.

In the [MySQL (best combination with PHP) d] configuration section, add:

Max_connections = 1000 save and restart MySQL (the best combination with PHP) service.

Then use the command: Wuxi artificial abortion surgery how to http://www.120csjlyy.com/

MySQL (the best combination with PHP) admin-uroot-p variables

After entering the password of the root database account, you can see

| | max_connections | 1000 | View the number of MySQL connections and current user Mysql connections |

First enter the mysql prompt as an administrator.

# mysql-uroot-pxxxx

Mysql > show processlist; can display the first 100 connection information show full processlist; can display all. By the way, if you log in with an ordinary account, only this user's. Note that there is a semicolon after the command.

If we want to view this server settings.

# vi / etc/my.cnfset-variable=max_user_connections=30 this is the number of connections per user set-variable=max_connections=800

This is the global limit on the number of connections.

Summary

The above is a detailed explanation of the method of viewing the current number of connections in mysql introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave a message for me, and the editor will reply to you in time. Thank you very much for your support to the website!

If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report