Showing posts with label connection error. Show all posts
Showing posts with label connection error. Show all posts

Wednesday, 16 September 2009

How do you get phpmyadmin to work after you have changed or given mysql a password?

I have recently install XAMPP on my machine which made installing Apache, MySQL and PHP a doddle. I have to confess I wouldn't of had a clue how to install these components individually and whilst I'm sure I could have located and installed them, XAMPP makes this damn easy!

Whilst XAMPP is a great tool it is for development purposes by default and openly warns you that there are some big security holes left open on installation - so don't use, certainly out of the box, as a production environment.

One of the open features of the installation is the MySQL is installed with a blank root password. Using the latest version of XAMPP there is a fantastic web page found using the security link on the \localhost\xamp page that allows you to secure folders and set a mysql root password. On an older version this assistant is not available, so me being me I setup a root password for mySQL just for neatness on my development box. Alas, after doing so the phpmyadmin page no longer longer loads because it cannot connect to the database - doh. Ok, so all you need to do to solve this is locate the config.inc.php file in the phpmyadmin folder under the xampp install folder and open the file up in a text editor. Have a look for ['Servers'][$i]['user'] = 'root' and there will also be a statement that follows that is for ['password'] = '' obviously from here you can update the password and reload your admin.

I will add, and I have to admit being unable to remember at this second, you may need to restart Apache after making this change. I would make the change, retry the page - if you retry the page and you are sure you have entered the correct credentials and it still fails then give it a restart!