I have WAMP installed on my local PC. I had been using the mysql console to create my database files. Now I had created a gallery page for a site where the photos are being drawn from a database.

I had gone through the following steps.

  • On my local machine, I exported the database to a .sql file.
  • Logged on to cpanel of HG and created a MySQL database called photogallery.
  • Still in the cpanel at HG, created a database user called jppp.
  • Added a username with privileges.
  • Still in the cpanel at HG, clicked on phpmyadmin, located the database, and then imported the .sql file.
  • I got the message, “database imported successfully”.
Meanwhile, I had gone to the config.inc file on my local machine and did the following.

  • Changed the name of my database from photogallery to jppp_photogallery.
I thought that I was on the right track. But just yesterday, I had visited the local server and found that the phpadmin link is not working.
I am getting an error like this;

Welcome to phpMyAdmin 2.11.6


MySQL said: #2003 - Can't connect to MySQL server on 'localhost' (10061)

I was quite shocked to see this. I tried closing down my computer and logging in again. But I continue to get the same error. I tried logging on to mysql console after starting the wamp server. I do not have any problem there.

Then I went to my local server (http://127.01.01) and tried visiting my gallery page. But I find that I am having a problem there too.

When I try to go to my viewgallery.php page, I get the following error.

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'Username'@'localhost' (using password: YES) in C:\wamp\www\xyz.com\config.inc.php on line 3
Could not select database

Now how can there be an error on line 3 suddenly when it was working fine till now. Has it got anything to do with the export and import that I did? Why have I run into an error like this suddenly?
#2003 - Can't connect to MySQL server on 'localhost' (10061)