0

So I had installed MySQL from a download. It was working fine. My socket file mysql.sock was located at /private/tmp

After installing homebrew (don't know if it's directly related to homebrew) my socket file disappeared.

I look for it /private/tmp/mysql.sock and it's not there anymore.

I can't start the MySQL daemon. I can't login to my database. MySQL Workbench can't connect.

I've been looking for mysql.sock file and the my.cf file but I can't find them.

When I try to connect using the terminal, I get this error ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

In MySQL Startup I get `Warning: The /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' user.

I have already done the following: https://stackoverflow.com/questions/4762543/mysql-what-user-should-own-usr-local-mysql-on-mac

sudo chown -R _mysql:wheel /usr/local/mysql/data
sudo chown -R mysql:wheel /usr/local/mysql/data

What would be the reason my mysql.sock file disappeared and how can I make MySQL work again?

leonel
  • 979
  • 2
  • 7
  • 8
  • I don't know if it's the same on OSX, but on Linux, the socket file is created when MySQL starts and destroyed when the server stops. So it would make sense that you couldn't find the socket file if the daemon isn't running. – Safado Jan 16 '13 at 17:45
  • And unless it was removed in Mountain Lion, OSX has the 'locate' command. In a terminal, type `locate my.cnf` or just do a find from root up .. `find / -name 'my.cnf'` – Safado Jan 16 '13 at 17:54
  • the only places I find `my.cnf` is under a directory called `mysql-test` it's not that one right? i find 2 of those files – leonel Jan 16 '13 at 19:25
  • On 10.6, if I run `sudo dtruss /usr/local/mysql/bin/mysqld_safe`, I saw that it tried to load in the my.cnf file from `/usr/local/mysql/my.cnf` by default. If that file doesn't exist, you can make a new one right there and it should read it (unless of course, your system is looking somewhere else). Using dtruss you should also be able to see where it's attempting to write to the error log, so between the dtruss output and the error log, you can probably find what the problem is. – Safado Jan 17 '13 at 16:11

1 Answers1

0

you should try to run it again then look in your Console to see whatever errors it's producing and resolve them, also take a look at my.cnf to see where it's logging (as it usually goes to separate file as well)

alexus
  • 13,112
  • 32
  • 117
  • 174