Skip to content

Instantly share code, notes, and snippets.

@zgulde
Last active December 8, 2015 16:45
Show Gist options
  • Save zgulde/68bc8a2b8fd83f24d9d6 to your computer and use it in GitHub Desktop.
Save zgulde/68bc8a2b8fd83f24d9d6 to your computer and use it in GitHub Desktop.
How I enabled logging of all queries in mysql
  1. In your vagrant box edit /etc/mysql/my.cnf

  2. uncomment these two lines

    • #general_log_file = /var/log/mysql/mysql.log
    • #general_log = 1
  3. restart your vagrant box

  4. all queries will now be logged to /var/log/mysql/mysql.log

    • note that you will have to open a root shell to access this file
  5. (optionally) copy the log file somewhere

    • # cat /var/log/mysql/mysql.log > /vagrant/sites/codeup.dev/logs/mysql.log
  6. Be aware that you should probably not do this long term,

    • taken straight from my.cnf
    • # Be aware that this log type is a performance killer.

Note: after running an ansible command to create a new db, the my.cnf file was reset!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment