Enable MySQL logs in MAC OS X

Ramindu De Silva
1 min readMay 12, 2019

--

You can download and install MySQL in several ways

  • Download latest .dmg file for MySQL Community server from here
  • Using homebrew: brew install mysql

Creating and giving permission to mysql.log file

  1. Create a log file /Users/ramindu/mysql/mysqllogs/mysql.log
  2. Provide the following permissions
  • chmod 777 /Users/ramindu/mysql/mysqllogs/
  • chmod 755 /Users/ramindu/mysql/mysqllogs/mysql.log
  • sudo chown mysql:mysql /Users/ramindu/mysql/mysqllogs/mysql.log

Configuring the log file in my.cnf

  1. The default my.cnf is created in /etc/my.cnf (create, if it does not exist)
  2. execute the following commands in the command line
  3. Add the following lines in the my.cnf
  • general_log_file=/Users/ramindu/mysql/mysqllogs/mysql.log
  • general_log=1
  1. Restart mysql
  2. Execute the command: show variables like ‘general_log%’;
  3. The result table should be as follows.

--

--

No responses yet