Enable log for queries on MySQL

December 23, 2011 | SQL

MySQL Logo

Generally we will get some situations where we need to see the each and every query hitting the MySQL server, especially while debugging.
Viewing each & every query hitting any MySQl database is possible by enabling the logs in MySQL configuration.

  1. Go to the MySQL home directory where you installed MySQL.

    In my case it is

    C:\wamp\bin\mysql\mysql5.5.8\

    as I installed MySQL as a part of WAMP. Or else if MySQL is installed as standalone community server the path will be something like

    C:\Program Files\MySQL\MySQL Server 5.5\
  2. Open my.ini file and add the following line somewhere
    log=c:/wamp/logs/mysqlQueries.log

    Change the path to desired folder.

  3. And now onwards you can see each & every query hitting the MySQl server on this “mysqlQueries.log” file, even the queries executed from any programming language like Java, .net etc.

Tags: , ,

Leave a Reply

If you have a Tip, Comment, Article or anything you want to share, please send it to: i@poisure.com