我想记录所有
mysql查询以及较慢的查询.
我找到了这个文档 – https://documentation.mamp.info/en/documentation/mamp/
但我发现只有错误日志
如何启用/拥有有关mysql php和apache的所有日志?
最佳答案 首先,备份/Applications/MAMP/bin/startMysql.sh
接下来,在您喜欢的文本编辑器中打开/Applications/MAMP/bin/startMysql.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-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
所以文件内容应如下所示:
# /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 &
然后
>保存文件
>重启MAMP
>开始点击页面并监控文件,
/应用程序/ MAMP /日志/ slow_query_log
这应该适用于MAMP 1.4.1. YMMV可能会有所不同,具体取决于您的MySQL版本.
The concept is the same, but the syntax can change in later versions.