MAMP Pro: Enable MySQL General Logging
If you are looking to see exactly what your MySQL server is doing (this includes logging of all query’s on your databases) you enable the MySQL general query log. By default, this is disabled in the MAMP my.cnf configuration file. In fact, the general query log directive does not exist in the configuration file of MAMP it seems. Follow the steps below.
- Open MAMP and go to Edit Template -> MySQL -> your version.cnf.
- Find [mysqld] in your configuration file. This is typically found around line 26. We must enable the general query log under this [mysqld] setting.
- Add the following 2 lines to enable general logging. You can just add these under the socket directive pictured below.
general_log = 1
general_log_file = "/Applications/MAMP/logs/mysql_access.log"
- Save the file.
- Restart MAMP Apache and MySQL Servers.
Note: MySQL general logging will quickly fill up your log file, especially if you have multiple databases being queried often. It is not advised to leave this enabled for an extended period of time and should only be used to troubleshoot things temporarily.
Browse some of your sites to invoke queries. Check your mysql_access.log
file to see the details of the query’s and more.