2009-03-09

Mysql logging

One day or another, you'll want to check what exactly your MySQL server is doing (to check for SQL injections for instance). Therefore:
  • To log all SQL queries, add the following to your my.cnf (in the [mysqld] section)
    log=/var/log/mysqld.log
  • To log queries that actually modify the database:
    log-bin
    If you don't modify the default log-bin parameters, this would create a <servername>-bin.###### & index in your /var/lib/mysql, which you can then analyze with mysqlbinlog

No comments:

Post a Comment