Thursday, June 27, 2013

How to enable Mysql query log

If you need to log down all queries executed by Mysql for troubleshooting:

vi /etc/my.cnf
#add in this line:
log=/tmp/mysql.log
After that restart your mysqld service

/etc/init.d/mysqld restart
you can then use commands such as tail command to trace from the log file

tail -f /tmp/mysql.log
Please do turn off the logging by removing the log configuration and restart the mysqld service again, as the log file could grow huge and using up space in /tmp partition

No comments:

Post a Comment