Wednesday, November 7, 2012

How to get all logs from Mysql server


For CentOS:

Put following to /etc/mysql/my.cnf: 
log=/var/log/mysql/mysql_log.log 
general_log = 1 
general_log_file = /var/log/mysql/mysqld.log 
log-warnings = 2 
log-error = /var/log/mysql/mysqld.error.log 
slow_query_log =1 
slow_query_log_file = /var/log/mysql/mysqld_slow.log 


Restart Mysql service (service mysqld restart) 
Setup logging: 
mysql> SET GLOBAL general_log = 'ON'; 
Check logging variables: 
mysql> SHOW VARIABLES LIKE "general_log%";

No comments:

Post a Comment