Locate MySQL Log Files When Using macOS

If you use macOS, you may use the following SQL statement to locate your MySQL logs:

SHOW VARIABLES LIKE '%general_log%';  
SHOW VARIABLES LIKE '%slow_query_log%';  

The output should be something like:

general_log            ON
general_log_file       /usr/local/mysql/data/localhost.log
slow_query_log         ON
slow_query_log_file    /usr/local/mysql/data/localhost-slow.log

Now you can use tail show old and new entries in the logs:

tail -f -n 100 /usr/local/mysql/data/localhost.log  

Enable Logs

If your logs are disabled, you can enable them by using these SQL statements:

SET GLOBAL general_log = 'ON';  
SET GLOBAL slow_query_log = 'ON'; 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top