A Free Template From Joomlashack

A Free Template From Joomlashack

Troubleshooting MySQL queries in MAMP

PDF Print E-mail
Written by Kirby   
Friday, 30 January 2009 01:04

Here's a MAMP specific hack for finding what MySQL queries are killing your application.

First, backup /Applications/MAMP/bin/startMysql.sh

Next, pop open /Applications/MAMP/bin/startMysql.sh in your favorite text editor
You should see something like this:

# /bin/sh
/Applications/MAMP/Library/bin/mysqld_safe --port=3306 --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 &

You want to add in this string to that command:
--log-slow-queries=/Applications/MAMP/logs/slow_query_log

So the file contents should look like:

# /bin/sh
# /bin/sh /Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lower_case_table_names=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-slow-queries=/Applications/MAMP/logs/slow_query_log --log-error=/Applications/MAMP/logs/mysql_error_log &

Save out the file, restart MAMP, start hitting pages and monitor the file, /Applications/MAMP/logs/slow_query_log

This should be fine for MAMP 1.4.1. YMMV may vary, depending on your MySQL version. The concept is the same, but the syntax can change in later versions.

 
Joomla 1.5 Templates by Joomlashack