View logs in MySQL

Source: Internet
Author: User

Find the MySQL installation directory

Whereis MySQL

 

View the VaR directory

 

View MySQL Configuration

Whereis my. CNF

Or

Mysql> show variables like '% log % ';

 


# Vi/etc/My. CNF

[Mysqld]
Wait_timeout = 10

#/Etc/init. d/MySQL restart

However, this method is too stiff, so we should try to avoid restarting the online service no matter what, to see how to set it in the MySQL command line:

Mysql> set global wait_timeout = 10;





Mysql> show global variables like 'wait _ timeout ';
+ ---------------------------- + ------- +
| Variable_name | value |
+ ---------------------------- + ------- +
| Wait_timeout | 10 |
+ ---------------------------- + ------- +

 

 

Http://blog.chinaunix.net/u/14014/showart_490462.html

 

 

Mysql> show variables like '% timeout ';

The output is as follows:

+ ---------------------------- + ------- +
| Variable_name | value |
+ ---------------------------- + ------- +
| Connect_timeout | 5 |
| Delayed_insert_timeout | 300 |
| Interactive_timeout | 28800 |
| Net_read_timeout | 30 |
| Net_write_timeout | 60 |
| Slave_net_timeout | 3600 |
| Wait_timeout | 28800 |
+ ---------------------------- + ------- +
Interactive_timeout takes effect after the client_interactive option is set in mysql_connect () and is assigned as wait_timeout;

Mysql> set wait_timeout = 10; valid for the current interactive link;
Mysql> set interactive_timeout = 10; valid for subsequent interaction links;

The timeout time is measured in seconds and starts from the time after the last SQL statement is executed. If the current idle time exceeds this time, the variable is forcibly disconnected.

 

 

Http://blog.sina.com.cn/s/blog_473d5bba0100051j.html

 

 

 

The number of seconds that the interactive_timeout server waits for action on an interactive connection before closing the connection. An interactive customer is defined as a customer who uses the client_interactive option for mysql_real_connect (). The default value is 28800. The number of seconds the wait_timeout server waits for action on a connection before closing the connection. The default value is 28800. That is, if nothing happens, the server closes the connection after 8 hours.   Bytes:
My understanding of the parameter "Wait-Timeout" is the maximum idle time value for the mysql client database connection.
To put it bluntly, when your MySQL connection is idle for more than a certain period of time, it will be forcibly closed. The default wait-Timeout value of MySQL is 8 hours.
Setting this value is very meaningful. For example, your website has a large number of MySQL connection requests (each MySQL connection requires memory resource overhead), because your Program The reason is that a large number of connection requests are idle and nothing is done. The memory resources are used up in vain, or the connection cannot be created when MySQL exceeds the maximum number of connections, resulting in a "Too worker connections" error. Before setting, you can check the status of your MySQL (show processlist is available). If you find that your MySQL has a large number of sleep processes, you really need to set your wait-timeout. If you set wait-Timeout = 10, all sleep threads in MySQL can only "Sleep" for up to 10 seconds, and are forcibly disabled.
This is useful for MySQL with heavy load.

 

 

================================

The maximum number of connections in MySQL is 100 by default. Client Logon: mysql-h127.0.0.1-uusername-ppassword
Set the new maximum number of connections to 200: mysql> set global max_connections = 200
Display the currently running query: mysql> show processlist
Display Current status: mysql> show status

Exit the client: mysql> exit

 

Display by hostname

Mysqladmin-u root-P processlist | grep 10.20.126.1

Http://dev.mysql.com/doc/refman/5.5/en/show-processlist.html

 

 

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.