Enabling Mysql Logging: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
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..." |
Dcunningham (talk | contribs) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
==On the fly== |
==On the fly (Mysql 5.1 and above)== |
||
On the mysql client command line: |
On the mysql client command line: |
||
| Line 20: | Line 20: | ||
Use "quit" to exit the mysql console. |
Use "quit" to exit the mysql console. |
||
==In my.conf== |
==In my.conf (all Mysql versions)== |
||
* Create the log file and set permissions: |
* Create the log file and set permissions: |
||
Latest revision as of 04:44, 11 June 2015
On the fly (Mysql 5.1 and above)
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 (all Mysql versions)
- 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.