Enabling Mysql Logging

From Integrics Wiki
Revision as of 00:38, 25 February 2015 by Dcunningham (talk | contribs) (Created page with "==On the fly== On the mysql client command line: <code><pre> touch /var/log/mysql.log chown mysql /var/log/mysql.log mysql -u root enswitch -p </pre></code> At the mysql co...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

On the fly

On the mysql client command line:

touch /var/log/mysql.log
chown mysql /var/log/mysql.log
mysql -u root enswitch -p

At the mysql console type:

SET GLOBAL general_log_file = '/var/log/mysql.log';
SET GLOBAL general_log = 1;

Make the test call, and then to disable logging type at the mysql console:

SET GLOBAL general_log = 0;

Use "quit" to exit the mysql console.

In my.conf

  • Create the log file and set permissions:
touch /var/log/mysql.log
chown mysql /var/log/mysql.log
  • Edit /etc/mysql/my.conf or /etc/my.conf (whichever exists on your system) and add or uncomment the lines:
general_log_file = /var/log/mysql.log
general_log = 1
  • Save and exit your text editor.
  • Run:
/etc/init.d/mysqld restart
  • After you've obtained the information required remember to comment out the logging lines again and restart MySQL, otherwise the log file will grow extremely large. It does not wrap itself.