Showing posts with label Cannot log in to the MySQL server. Show all posts
Showing posts with label Cannot log in to the MySQL server. Show all posts

Saturday, 19 May 2012

Administrating a mySQL database with phpMyAdmin

Just a quick gotcha for OSX, mySQL and phpMyAdmin.

I had successfully set up mySQL and secured the default accounts with passwords. Although shipping a product without passwords may be thought of as a security hole, it is just as bad as shipping with a default password.

Downloaded and installed phpMyAdmin onto the macbook and configured according to instructions. 

Did it work? Did it heck! 

After a while googling for answers, I read through another install guide (although for Lion not Snow Leopard) and found this gem: 

Edit config.inc.php using your favorite editor (I prefer vi) and change$cfg['Servers'][$i]['host'] = ‘localhost’; to $cfg['Servers'][$i]['host'] = ’127.0.0.1′;*Well it sounds stupid because localhost and 127.0.0.1 are same in networking world but phpMyAdmin won’t let you (At least me) log in without this change and keeps throwing error “#2002 Cannot log in to the MySQL server”
This is one of the classic IT gotcha's: two things that are supposed to give the same result don't. I'm almost tempted to see if it is the same on a linux machine, but don't want to get diverted.

Next steps will be to start reading up seriously on PHP MVC frameworks - I'm currently looking at cakePHP.

I really can't remember how we did this stuff before the internet was available, and many of the younger developers probably can't imagine the idea. Perhaps that is why I have a largish collection of computing books going back to VB5 and Access 2 in my bookshelves. Although that could just be because I hate to get rid of books.