Enable MySQL logs in MAC OS X
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
- Create a log file /Users/ramindu/mysql/mysqllogs/mysql.log
- 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
- The default my.cnf is created in /etc/my.cnf (create, if it does not exist)
- execute the following commands in the command line
- Add the following lines in the my.cnf
- general_log_file=/Users/ramindu/mysql/mysqllogs/mysql.log
- general_log=1
- Restart mysql
- Execute the command: show variables like ‘general_log%’;
- The result table should be as follows.