MySQL, view the number of connections and status, etc.

Source: Internet
Author: User

1, mysql> show status like '%connect% ';

Connections, the number of connections that attempted to connect to the MySQL server (regardless of success).
Max_used_connections, the maximum number of connections that have been used at the same time since the server started.
threads_connected, the current number of connections.

2, mysql> show variables like '%connect% ';

Max_connections, maximum number of connections.

3, modify the Max_connections

In the configuration file (my.cnf or My.ini) at the bottom of the day, add a sentence:
max_connections=32000
Then, restart with the command:/etc/init.d/mysqld restart
Although 32000 is written here, the actual MySQL server allows the maximum number of connections 16384;
The maximum number of allowed connections is added, which increases the system consumption.

4, mysql> show processlist;
Displays the currently executing MySQL connection.

Mysql> Show status like '%connect% '; +-----------------------------------------------+-------+| variable_name | Value |+-----------------------------------------------+-------+| aborted_connects | 2 | | connection_errors_accept | 0 | | connection_errors_internal | 0 | | connection_errors_max_connections | 0 | | connection_errors_peer_address | 0 | | Connection_errors_select | 0 | | Connection_errors_tcpwrap | 0 | | Connections | 445 | | max_used_connections | 61 | | Performance_schema_session_connect_attrs_lost | 0 | | ssl_client_connects | 0 | | Ssl_connect_renegotiates | 0 | | ssl_finished_connects | 0 | |                            threads_connected | |+-----------------------------------------------+-------+14 rows in Set (0.00 sec) mysql> Show variables like '%c Onnect% '; +-----------------------------------------------+-----------------+| variable_name | Value |+-----------------------------------------------+-----------------+| character_set_connection | UTF8 | | collation_connection | Utf8_general_ci | | Connect_timeout | 10 | | Disconnect_on_expired_password | On | |                 Init_connect | || max_connect_errors | 100 | | max_connections | 151 | | max_user_connections | 0 | | Performance_schema_session_connect_attrs_size | |+-----------------------------------------------+-----------------+9 rows in Set (0.00 sec) mysql> Show processlist; +-----+------+---------------------+------+---------+------+-------+------------------+| Id | User | Host | db | Command | Time | State | Info |+-----+------+---------------------+------+---------+------+-------+------------------+| 315 | Srea | 192.168.0.206:58566 | Srea | Sleep |       3370 | | NULL | | 316 | Srea | 192.168.0.206:58567 | Srea | Sleep |       3370 | | NULL | | 317 | Srea | 192.168.0.206:58568 | Srea | Sleep |       3370 | | NULL | | 318 | Srea | 192.168.0.206:58569 | Srea | Sleep |       3370 | | NULL | | 319 | Srea | 192.168.0.206:58570 | Srea | Sleep |       3370 | | NULL | | 320 | Srea | 192.168.0.206:58572 | Srea | Sleep |       3370 | | NULL | | 321 | Srea | 192.168.0.206:58575 | Srea | Sleep |       3370 | | NULL | | 322 | Srea | 192.168.0.206:58576 | Srea | Sleep |       3370 | | NULL | | 323 | Srea | 192.168.0.206:58577 | Srea | Sleep |       3370 | | NULL | | 324 | Srea | 192.168.0.206:58578 | Srea | Sleep |       3370 | | NULL | | 325 | Srea | 192.168.0.206:58579 | Srea | Sleep |       3370 | | NULL | | 326 | Srea | 192.168.0.206:58581 | Srea | Sleep |       3370 | | NULL | | 327 | Srea | 192.168.0.206:58582 | Srea | Sleep |       3370 | | NULL | | 328 | Srea | 192.168.0.206:58583 | Srea | Sleep |       3370 | | NULL | | 329 | Srea | 192.168.0.206:58586 | Srea | Sleep |       3370 | | NULL | | 330 | Srea | 192.168.0.206:58587 | Srea | Sleep |       3370 | | NULL | | 331 | Srea | 192.168.0.206:58589 | Srea | Sleep |       3370 | | NULL | | 332 | Srea | 192.168.0.206:58590 | Srea | Sleep |       3370 | | NULL | | 334 | Srea | 192.168.0.206:59012 | Srea | Sleep |       2920 | | NULL | | 335 | Srea | 192.168.0.206:59,342 | Srea | Sleep |       2487 | | NULL | | 336 | Srea | 192.168.0.206:59343 | Srea | Sleep |       2545 | | NULL | | 337 | Srea | 192.168.0.206:59344 | Srea | Sleep |       2545 | | NULL | | 338 | Srea | 192.168.0.206:59345 | Srea | Sleep |       2545 | | NULL | | 339 | Srea | 192.168.0.206:59346 | Srea | Sleep |       2545 | | NULL | | 340 | Srea | 192.168.0.206:59347 | Srea | Sleep |       2545 | | NULL | | 341 | Srea | 192.168.0.206:59348 | Srea | Sleep |       2545 | | NULL | | 342 | Srea | 192.168.0.206:59349 | Srea | Sleep |       2544 | | NULL | | 343 | Srea | 192.168.0.206:59350 | Srea | Sleep |       2544 | | NULL | | 344 | Srea | 192.168.0.206:59351 | Srea | Sleep |       2544 | | NULL | | 345 | Srea | 192.168.0.206:59352 | Srea | Sleep |       2544 | | NULL | | 346 | Srea | 192.168.0.206:59353 | Srea | Sleep |       2544 | | NULL | | 347 | Srea | 192.168.0.206:59354 | Srea | Sleep |       2544 | | NULL | | 348 | Srea | 192.168.0.206:59355 | Srea | Sleep |       2544 | | NULL | | 349 | Srea | 192.168.0.206:59356 | Srea | Sleep |       2544 | | NULL | | 350 | Srea | 192.168.0.206:59357 | Srea | Sleep |       2544 | | NULL | | 351 | Srea | 192.168.0.206:59358 | Srea | Sleep |       2544 | | NULL | | 353 | Srea | 192.168.0.206:59341 | Srea | Sleep |       2503 | | NULL | | 354 | Srea | 192.168.0.206:59340 | Srea | Sleep |       2486 | | NULL | | 418 | Srea | 192.168.0.206:52115 | Srea |  Sleep |       643 | | NULL | | 419 | Srea | 192.168.0.206:52140 | Srea |  Sleep |       717 | | NULL | | 420 | Srea | 192.168.0.206:52145 | Srea |  Sleep |       717 | | NULL | | 421 | Srea | 192.168.0.206:52148 | Srea |  Sleep |       717 | | NULL | | 422 | Srea | 192.168.0.206:52,151 | Srea |  Sleep |       717 | | NULL | | 423 | Srea | 192.168.0.206:52154 | Srea |  Sleep |       717 | | NULL | | 424 | Srea | 192.168.0.206:52157 | Srea |  Sleep |       717 | | NULL | | 425 | Srea | 192.168.0.206:52159 | Srea |  Sleep |       716 | | NULL | | 426 | Srea | 192.168.0.206:52160 | Srea |  Sleep |       716 | | NULL | | 427 | Srea | 192.168.0.206:52161 | Srea |  Sleep |       716 | | NULL | | 428 | Srea | 192.168.0.206:52164 | Srea |  Sleep |       716 | | NULL | | 429 | Srea | 192.168.0.206:52167 | Srea |  Sleep |       716 | | NULL | | 430 | Srea | 192.168.0.206:52169 | Srea |  Sleep |       716 | | NULL | | 431 | Srea | 192.168.0.206:52172 | Srea |  Sleep |       716 | | NULL | | 432 | Srea | 192.168.0.206:52175 | Srea |  Sleep |       716 | | NULL | | 433 | Srea | 192.168.0.206:52179 | Srea |  Sleep |       716 | |NULL | | 436 | Srea | 192.168.0.206:52114 | Srea |  Sleep |       668 | | NULL | | 437 | Srea | 192.168.0.206:52112 | Srea |  Sleep |       641 | | NULL | | 444 | Root | localhost | NULL |    Query | 0 | init | Show Processlist |+-----+------+---------------------+------+---------+------+-------+------------------+57 rows In Set (0.00 sec)

  

MySQL, view the number of connections and status, etc.

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.