MySQL Logging
Sometimes it may become necessary, to view logs from MySQL, this can include error logs, slow queries and even general queries altogether. They can be used for troubleshooting a system or enhancing performance.
Below are instructions for how to enable logging on Windows based operating systems. Error logs contain problems with the mysql process, where general logs include ALL queries made on the system.
Depending on your Windows version, the file you need to edit can be in several different locations.
On Windows XP:
In Windows XP the file you need to edit is likely in, C: > Program Files > MySQL > MySQL Server (5.0) > my
Go to the section:
[mysqld]
and paste the following below [mysqld]:
#logging
log-error = "c:/mysql_error.log"
log = "c:/general.log"
On Windows 7:
In Windows 7 the file you need to edit is likely in, C: > Program Files (x86) > MySQL > MySQL Server (5.0) > my
Go to the section:
[mysqld]
and paste the following below [mysqld]:
#logging
log-error = "c:/mysql_error.log"
log = "c:/general.log"
File Location
Note that you can place these files wherever you want, as long as the folder exists before hand, otherwise mysql will fail to start.
MySQL Version
These changes are for mysql 5.0, if your version is 5.1 log = "c:/general.log" must be changed to general-log-file = "c:/general.log"
MySQL Version
MySQL 5.6 is the current GA version. Use the following under the mysqld configuration.
log-output = FILE
general-log = 1
general_log_file=C:/wamp/logs/general-query.log