Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enable mysql query log

I am using wamp wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-32b mysql version is 5.6.17. It provides mysql and php servers.

I want to track (see) the queries recently executed (from anywhere i.e a web page, desktop app or any service using mysql on mysqlserver.

I know "what to do" = > i have to enable query logging as told by http://dev.mysql.com/doc/refman/5.6/en/query-log.html

But i dont know "how to do" though i have seen How to enable MySQL Query Log? but i am unable to find my.cnf anywhere. What i have is my.ini in wamp\bin\mysql\mysql5.6.17

As i use wamp so I am not familiar with mysql console. I want to know how (where) to set general_log_file=/path/to/query.log

like image 413
Sami Avatar asked Sep 28 '15 11:09

Sami


People also ask

How do I enable MySQL query logging?

To disable or enable the general query log or change the log file name at runtime, use the global general_log and general_log_file system variables. Set general_log to 0 (or OFF ) to disable the log or to 1 (or ON ) to enable it. Set general_log_file to specify the name of the log file.

Where is the MySQL query log?

The error, slow query, and binary logs are enabled by default, but the general query log is not enabled. The default location for each of the logs is the MySQL Data directory (C:\ProgramData\MySQL\MySQL Server [version number]\Data\), and the default log names are based on the computer's device name.

How do I view query logs in MySQL workbench?

MySQL Workbench start up and SQL actions are logged and stored in the log/ directory. This directory is in the user's MySQL Workbench directory. To find these text files, select Show Log Files from the Help menu.


2 Answers

Using the WAMPServer menu system edit the my.ini file. WAMPServer uses a my.ini and not a my.cnf

(left click wampmanager) wampmanager->MySQL->my.ini

This will open the correct my.ini file with notepad.

Check for these parameters and if they dont exists add them under the section heading [wampmysqld] or if you are using 64bit WAMPServer the [wampmysqld64]

NOTE: If you are using the 64bit WAMPServer you may have to change [wampmysqld] to [wampmysqld64] as the 64bit release had a little bug in it and this section header was not set correctly. The filename may also be c:\wamp64 on 64bit WAMPServer systems.

log-output = FILE
general_log = 1
general_log_file=C:/wamp/logs/general-query.log

Save the file and then restart MySQL Server (restart WAMP in your case)

Check in the C:\wamp\logs folder for the new general-query.log file.

like image 97
RiggsFolly Avatar answered Oct 10 '22 16:10

RiggsFolly


If 64bit version, be sure the log will be created in "C:/wamp64/logs/general-query.log" instead of "C:/wamp/logs/general-query.log".

like image 43
iomatt Avatar answered Oct 10 '22 16:10

iomatt