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