Search code examples
mysqlwindowswampserver

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


Solution

  • 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.