I checked /var/log and /usr/local/mysql and i can't seem to find the log. I am trying to troubleshoot an error establishing a database connection with a php function.
MySQL Logs – Where to Find MySQL Log on OS X
log-filesmac-osxMySQL
log-filesmac-osxMySQL
I checked /var/log and /usr/local/mysql and i can't seem to find the log. I am trying to troubleshoot an error establishing a database connection with a php function.
Best Answer
As Chealion mentioned, there are several ways that your mysql could have been installed. Each of which will place your data dir and/or logs in different locations. The following command will give you (and us) a good indication of where to look.
Can you post the result of that command here please? Mine looks like this:
From that you can see that my datadir is
/opt/local/var/db/mysql
(because I installed via MacPorts). Let's take this lesson a bit further...From the first line you can see the my daemon is
/opt/local/libexec/mysqld
. Themysqld
can be called with--verbose --help
to get a list of all command line options (and here is the important/valuable part!) followed by the values that would be used if you were launching mysqld instead of just checking the help output. The values are the result of your compile time configuration,my.cnf
file, and any command line options. I can exploit this feature to find out EXACTLY where my log files are, like so:Mine looks like this:
LO AND BEHOLD! all of the advice in the world was not going to help me because my log file is kept in a completely non-standard location! I keep mine in
/tmp/
because on my laptop, I don't care (actually I prefer) to loose all of my logs on reboot.Let's put it all together and make you a oneliner:
Execute that one command and you will get a list of all of the logs for your running instance of mysql.
Enjoy!
This Bash-Fu brought to you for free by my commitment to all things Open Source.