SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru
    Join Date
    Nov 2002
    Location
    Dubai
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    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


    Error


    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)

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The error message means a password is being sent to the database but is not the correct password for that user and that database.

  3. #3
    SitePoint Guru
    Join Date
    Nov 2002
    Location
    Dubai
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. But how could the password have changed suddenly when it was working fine till last week? I noticed this problem only after I finished the task of exporting and importing the files.

  4. #4
    SitePoint Guru
    Join Date
    Nov 2002
    Location
    Dubai
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When I logged in to my local server today, I found that the phpadmin link is working again. I really do not know what had gone wrong.
    But I am still not able to go to my gallery page, viewgallery.php. I do not know why I am facing this problem inspite of not having made any changes in the config.inc.php file.
    Should I go and change the username and password? I need some help to do it. Actually, when I had set the username and password, a friend had helped me to do it. And I had written the code for the config.inc.php file giving that username and password. Now, I tried googling and tried going to tutorials to find out how to set a new username and password so that I can try changing those in the config.inc.php file and try opening my gallery page once again.
    But I have not succeeded so far.

  5. #5
    SitePoint Guru
    Join Date
    Nov 2002
    Location
    Dubai
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can someone help me please?

  6. #6
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is more a question to do with php and the config file for it since you can already get into mysql, just not through your script. Have a moderator move the thread for you.

  7. #7
    SitePoint Guru
    Join Date
    Nov 2002
    Location
    Dubai
    Posts
    715
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had so far been working directly on the webhost's server. I went to check the phpadmin page of my local server today and once again found that it is not working and is giving the same error that I had mentioned above. More so, when I try to log on to MySQL using the mysql console, I find that the MS Dos screen flashes and then disappears. Why do I continue to get this type of problems?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •