Read more

How to enable MySQL query logging

Arne Hartherz
July 20, 2012Software engineer at makandra GmbH

This will make MySQL log all received queries so you can see for yourself what happens on the database level.

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

Don't switch this on for production machines!

  1. Edit your my.cnf:
    sudo vim /etc/mysql/my.cnf
  2. In the [mysqld] section, add:
    log=/var/log/mysql.log
  3. Restart your MySQL daemon. On Ubuntu:
    sudo service mysql restart

Note that your MySQL performance will suffer. But when you need to enable query logging for a debug fest, you probably don't care about that.

Posted by Arne Hartherz to makandra dev (2012-07-20 16:40)