monkeyUser
monkeyUser

Reputation: 4671

Enable logs in MAMP 3

I want to log all mysql queries and also slower queries.

I found this doc - https://documentation.mamp.info/en/documentation/mamp/

But I found only error logs

How can I enable / have all logs about mysql php and apache?

Upvotes: 4

Views: 1980

Answers (1)

Abdulla Nilam
Abdulla Nilam

Reputation: 38584

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 &

and then

  1. Save out the file
  2. restart MAMP
  3. 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.

Upvotes: 2

Related Questions