Home > TIP > Enable MySQL logging

Enable MySQL logging

MySQLEnabling MySQL log file:

In /etc/mysql/my.cnf, under Logging and Replication, uncomment log

# * Logging and Replication
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
log = /var/log/mysql/mysql.log

Restart MySQL

sudo /etc/init.d/mysql restart

View queries

tail -F /var/log/mysql/mysql.log

Turn it off when you’re done because:

* Impact on performance
* File size can grow quickly

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: