MAMP is a LAMP environment in an application for OS X. It saves a lot of time getting a local development environment going especially if you're changing computers often. If you use MAMP it may not be immediately straight-forward how to enable MySQL Query Logging since it has an executable that starts and stops MySQL and Apache and it uses a separate MySQL socket.
Why use sql query logging? A great way to learn about or optimize an application is to watch how it interacts with a database. You can issue a command from within an application and see exactly what commands it triggers to MySQL. This is extremely helpful when trying to get a handle on an application that utilizes an abstract and/or highly normalized data structure.
First, a couple warnings. MySQL Query Logging should only be used in development environments. The log files it creates could potentially become humongous in size. Also, it greatly reduces MySQL performance while it is running.
1) Stop MySQL with this command from Terminal
/Applications/MAMP/Library/bin/mysqladmin -u root -proot --socket=/Applications/MAMP/tmp/mysql/mysql.sock shutdown
2) Issue this command in Terminal
/Applications/MAMP/Library/bin/mysqld_safe --port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysql_error_log --log=/tmp/mysqlLOG.lg &
You can monitor the output of mysql in Terminal with this command:
sudo tail -f /tmp/mysqlLOG.lg
As you issue commands to your local MySQL server you will see them generated instantly in a continuous scroll in a terminal window.
MySQL Query Logging will run until the next to you stop MAMP. It will not do query logging unless you issue the start command as above and include the --log= directive.