Detailed explanation of how to view the current number of MySQL connections

Detailed explanation of how to view the current number of MySQL connections

1. View the detailed information 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 detailed information 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 view 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 (the default is 100).

Today, a MySQL server suddenly had a surge in connections, and all waiting processes were locked... Because of improper problem solving, I was scolded...OTL

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

After logging in to the MySQL client, you can also use the status command to obtain the number of thread connections and the ID of the current connection.

Or use

show full processlist

Take a look at all the connection processes, pay attention to the process waiting time and whether the status is locked

If there are too many processes, print out the processes and then check

mysql -e 'show full processlist;' > . This is usually because the current execution is stuck, causing the subsequent processes to be queued.

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

Edit MySQL (best combination with PHP) configuration file

my.cnf or my.ini

Add the following to the [MySQL (best combination with PHP)] configuration section:

max_connections = 1000 Save and restart the MySQL (best combination with PHP) service.

Then use the command: Where is the best place for abortion surgery in Wuxi? http://www.120csjlyy.com/

MySQL (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 the number of MySQL connections for the current user

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 a normal account, only this user's will be displayed. Note the 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 for a single userset-variable=max_connections=800

This is the global limit on the number of connections.

Summarize

The above is a detailed explanation of how to view the current number of MySQL connections introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Python connects to the database MySQL decompressed version installation configuration and encountered problems
  • Mysql view the maximum number of connections and modify the maximum number of connections
  • Summary of tips for setting the maximum number of connections in MySQL
  • Solution to the problem that the number of MySQL connections is limited to 214 in CentOS 7
  • How to set the number of mysql connections (Too many connections)
  • Perfect solution to the problem that MySQL cannot connect to the database through localhost
  • How to use Java Web to connect to MySQL database
  • Python 3.x database connection example (pymysql method)
  • PHP mysql operation mysql_connect connection database instance detailed explanation
  • Summarize two ways to modify the maximum number of connections in MySQL
  • How to set and get the number of Mysql connections

<<:  When backing up files in Centos7, add the backup date to the backup file

>>:  An article to understand operators in ECMAScript

Recommend

Vue implements dynamic query rule generation component

1. Dynamic query rules The dynamic query rules ar...

CentOS 6.5 configuration ssh key-free login to execute pssh command explanation

1. Check and install pssh, yum list pssh 2. Becau...

13 JavaScript one-liners that will make you look like an expert

Table of contents 1. Get a random Boolean value (...

In-depth analysis of the Identifier Case Sensitivity problem in MySQL

In MySQL, you may encounter the problem of case s...

JavaScript canvas realizes the effect of nine-square grid cutting

This article shares the specific code of canvas t...

Flash embedded in web pages and IE, FF, Maxthon compatibility issues

After going through a lot of hardships, I searched...

vue+ts realizes the effect of element mouse drag

This article example shares the specific code of ...

JavaScript anti-shake and throttling detailed explanation

Table of contents Debounce Throttle Summarize Deb...

VMware WorkStation 14 pro installation Ubuntu 17.04 tutorial

This article records the specific method of insta...

How to use IDEA to configure tomcat and create JSP files

Before using idea to write JSP files, you need to...

Implementation of navigation bar and drop-down menu in CSS

1. CSS Navigation Bar (1) Function of the navigat...

A complete guide to clearing floats in CSS (summary)

1. Parent div defines pseudo-classes: after and z...

Analysis of CocosCreator's new resource management system

Table of contents 1. Resources and Construction 1...

Detailed explanation of Nginx passively checking the server's survival status

introduce Monitors the health of HTTP servers in ...