I wanted to debug some SQL queries which are coming from my data access layer (JPA with Hibernate) and which are being send to my MySQL server. The following steps are needed:
- Create the file /etc/my.cnf (I installed MySQL manually from a .pkg installer, so the file is not there by default - you have to create it manually)
- Add the following lines:
[mysqld]
log=/tmp/mysql-query.log
- Create the .log file:
$ sudo touch /tmp/mysql-query.log
- Allow MySQL daemon to write in file:
$ sudo chown _mysql /tmp/mysql-query.log
- Restart MySQL daemon:
~ $ cd /usr/local/mysql/support-files/ /usr/local/mysql/support-files $ sudo ./mysql.server restart
Add new comment