I am a complete beginner, so please forgive me, but I would greatly appreciate a step-by-step walk through of how I can fix the following issue that is literal and detailed (e.g., instructing me to "Verify that the /tmp/mysql.sock file exists" is not helpful, as it does not explain how to verify that the file exists). My operating system is Mac OS X Version 10.8.5. I'm trying to install MySQL through Homebrew, which is required by an online course that I cam taking.
To uninstall the MySQL that I had previously installed on my computer, I entered the following commands in my Terminal:
$ brew unlink mysql
$ brew uninstall mysql
To install MySQL using Homebrew, I then entered the following command into my Terminal:
$ brew install mysql
The install was successful, but resulted in the following ambiguous "caveat":
==> Caveats
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
I decided to ignore this caveat and entered the following command to start the mysql server:
$ mysql.server start
Great! Entering this command generated the following message in my Terminal:
Starting MySQL
SUCCESS!
I next attempted to connect to my mysql server by entering the following command:
$ mysql -uroot
When I entered the above command, my Terminal produced the following error message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
How do I eliminate this error message and connect to my MySQL server? I have spent several hours troubleshooting this issue with no luck. As suggested in the top answer on stackoverflow here, to see if mysql is starting properly, I entered the following command:
$ /usr/local/bin/safe_mysqld
This resulted in a message stating that
No such file or directory
exists, which leads me to believe that this was not in fact a command but a directory path. So, again, my question is, how do I connect to mysql without getting the error message pasted above? Your suggestions are greatly appreciated and please let me know if I need to clarify anything in this question.