Breaking News
Loading...
13/12/2013

Show Log Configuration on MySQL

SHOW VARIABLES LIKE '%log%';

MySQL prior to 5.1.0 requires a change to the MySQL my.cnf file and a restart in order to log slow queries; from MySQL 5.1.0 you can change this dynamically without having to restart.

To disable or enable the slow query log:

SET GLOBAL slow_query_log = ON;

To disable or enable the general query log:

SET GLOBAL general_log = ON;

Setting the long query time
# minimum: 0.000001 (1 microsecond)

set global long_query_time = 5;

http://www.electrictoolbox.com/mysql-log-slow-queries/

If we want to configure log to a table, see the following link:
http://lserinol.blogspot.com/2009/02/mysql-general-query-log.html

Before Mysql version 5.1.6, you can only log to files

Set log to a table
SET GLOBAL log_output='table'; 

Or set log to a file
SET GLOBAL log_output='file'

We can set expire log days to limit the size of log table of file
set global expire_logs_days = 1;

Here is a document from Amazon about managing MySQL log file
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Concepts.MySQL.html

0 comments:

Post a Comment

 
Toggle Footer