OR if at first you don’t succeed, search and search again?
What started as a simple task chewed up a good hour of time today… Eager to start dabbling in Drupal, I decided to get the needed parts running locally on my MacBookPro. I got MySQL 5.x downloaded and installed. I mucked up my root passwords (typo) and spent 12 minutes in vain for the right way to reset it…. upscrolling my terminal window revealed the goof in my earlier set up of the root password (yup some of the time sink is my own fault).
Next I got a copy of phpMyAdmin, to run locally to do basic database admin. It should be a pretty basic set up since it is behind my firewall, so my security can be, well, lax. Yikes. I keep getting all kinds of errors:
MySQL said:#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)
which stumped me since I was connecting fine on the command line. And the socket file is where it is supposed to be.
So I googled the entire error message and got reams of hits, mostly people in forums asking for help. The first 5 guess attempts I followed were dead ends. Finally I got the right answer buried at Nick’s Tech Blog:
If you are running MySQL and phpMyAdmin on Mac OS X, and you just upgraded to OS X 10.4.4, you may have seen this error message when trying to access your MySQL server using phpMyAdmin: “The server is not responding (or the local MySQL server’s socket is not correctly configured)”. If this has happened to you, here is the fix:
1. load /private/etc/php.ini into your favorite editor. You may have to become root and change permissions on the file in order to edit it.
2. find the line that says ‘mysql.default_socket = ‘.
3. change that line to say ‘mysql.default_socket = “/tmp/mysql.sock”‘, and save php.ini.
4. as root, on the command line in a terminal window, restart the Apache webserver by typing ‘apachectl graceful’.
BINGO! Bling! That was it.
That is pretty obscure indeed. Thank you Google, thank you Nick.
I usually just create a symbolic link from /usr/mysql/mysql.sock to /tmp/mysql.sock and it works fine without tinkering with the config files. It’s a silly thing that started being required a while back.
For MySQL editing, definitely check out “CocoaMySQL” – it’s a native app that lets you modify the database and data, without mucking about in a web page or command-line mysql prompts. Also, there’s the new “MySQL Administrator” app provided by MySQL directly. It’s a separate download, but is sucking less than ever before.
And, for Drupal, you need to run the “database.4.1.mysql” script, even though you have 5.x installed.
Have fun with Drupal!
oh, and the mysql.sock location mismatch would have killed any PHP app, including PHPMyAdmin, and of course Drupal. You’ve already solved it, so all PHP+MySQL stuff should run fine now…
You should consider buying a Bluehost account (or equivalent) and using their GUI to manipulate some of this stuff–although I certainly understand the value and painful pleasure of doing it from scratch.