MySQL some write common commands

Source: Internet
Author: User

See pcttcnc2007 Blog Takeoff

Status information command for 1.mysql:

Mysql> show global status;

2. The MySQL server can be listed to run various status values, in addition, query the MySQL server configuration information statement:

Mysql> Show variables;

3. Number of connections

Often meet "mysql:error 1040:too many connections" situation, one is the traffic is really high, MySQL server can not resist, this time to consider increasing the load from the server to read the pressure, another situation is the MySQL configuration file max_ Connections value is too small:

Mysql> Show variables like ' max_connections ';
+-----------------+-------+
| variable_name | Value |
+-----------------+-------+
| max_connections | 256 |
+-----------------+-------+

The maximum number of connections for this MySQL server is 256, then query the maximum number of connections the server responds to:

Mysql> show global status like ' Max_used_connections ';

4. Slow Query

Mysql> Show variables like ' slow% ';

+------------------+-------+
| variable_name | Value |
+------------------+-------+
| log_slow_queries | On |
| Slow_launch_time | 2 |
+------------------+-------+

Mysql> show global status like ' slow% ';

+---------------------+-------+
| variable_name | Value |
+---------------------+-------+
| Slow_launch_threads | 0 |
| slow_queries | 4148 |
+---------------------+-------+

The configuration of the record slow query, the execution time of more than 2 seconds is slow query, the system shows that there are 4,148 slow query, you can analyze the slow query log, to find the problem of SQL statements, slow query time should not be set too long, otherwise the meaning is not big, preferably within 5 seconds, if you need a microsecond level of slow query

MySQL some write common commands

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.