How to Add MySQL Access Logs

In most versions of Linux edit the file:


Anywhere under [mysqld] add the line:


If log file doesn’t yet exists add and set permissions:

touch /var/log/mysqld.log
chown mysql:mysql /var/log/mysqld.log

Restart MySQL in:

cd /etc/rc.d/init.d
./mysqld restart

Post written by Ed Reckers

Founder and lead web development consultant at Red Bridge Internet : San Francisco WordPress Developers and Consultants.

One Response to “How to Add MySQL Access Logs”

  1. nobbler

    you have to add –log-warnings=x where x is larger than 1 to your mysqld execution parameters, see

Leave a Reply