MySQL query logging on Windows 7

I just spent 30 minutes on a seemingly trivial task. I wanted to see what the JPA is doing to my database so I decided to turn on mysql query logging. It should be simple three step operation:

  • Edit my.ini
  • add “log=query.log”.
  • restart Mysql

Tried it, did not work. I tried to put the my.ini file to all directories that MySQL is suposed to look into (c:\, c:\windows\, install dir). Nothing worked. Finally I checked the MySQL service startup commands and to my surprise there was

–defaults-file=”C:\ProgramData\MySQL\MySQL Server 5.5\my.ini”

I used standard MySQL installation for Windows, installed it as a service so I really do not understand that this is not mentioned in manual. Or I can not read. Anyway after I edited this file and put the “log=query.log” under [mysqld] group, restarted the server and finally the log was created in

c:\ProgramData\MySQL\MySQL Server 5.5\data\query.log

Heureka.