How real-time view of current connections mysql?

  1, view all current connection details:

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

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

  To view all current connection details:

  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 to see 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 connections mysql:

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

  Today there are a number of connections mysql server suddenly jumped, and wait for the process to be locked ... all because the problem is solved properly, leading to be scolded ... OTL

  Summary: To quickly locate the error later, layout solutions

  After logging into the mysql client, use the command status can be obtained thread id and the number of connections currently connected

  Or use

  show full processlist

  To see if all the state in which the connection process, pay attention to see the process of waiting time and locked

  If the process too much, put down the printing process, and then view

  mysql -e 'show full processlist;'> 111 non-locked find the process in general is currently executing stuck, the cause behind the process queue.

  In addition, the modification method mysql maximum number of connections:

  (Mix and match the best and PHP) to edit the MySQL configuration file

  my.cnf or my.ini

  In [(a sum of the best combination with PHP) MySQL d] configuration snippet:

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

  Then use the command: Wuxi abortion which is good http://www.120csjlyy.com/

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

  After entering the root account password database can be seen

  | Max_connections | 1000 | see the number of connections and the current MySQL user connections Mysql

  First enter the mysql prompt as an administrator.

  #mysql -uroot -pxxxx

  mysql> show processlist; 100 may be displayed before the connection information show full processlist; can show all. Under just saying, if an ordinary account login, it only shows that user. Note that the command after the semicolon.

  If we want to see this server settings.

  #vi /etc/my.cnfset-variable=max_user_connections=30 This is the number of single-user connection set-variable = max_connections = 800

  This is to limit the number of connections globally

 

Guess you like

Origin www.cnblogs.com/djw12333/p/10993355.html