Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2004

    Unanswered: Error 2003 – Can’t Connect to MySQL Server on ‘Localhost’.

    Hi - I'm a novice trying to learn MySQL and PHP with Kevin Yank’s Sitepoint book.

    I have Apache 1.3, PHP 4.3.8 and MySQL 4.1.7 ‘essential’ installed on a Win98SE box that I am using as a developer machine to create a simple contacts database.

    Apache runs with PHP and I can recognize PHP but I got the error below in DOS trying to connect to a database (residing in ‘data’ folder). This happens if I enter ‘mysql’ at the MySQL\ bin prompt.

    Error 2003 (HY000) Can’t connect to the MySQL server on ‘localhost’ (10061).

    The MySQL command line client asks for my password which, when entered, displays an error message of some sort for a microsecond and the DOS screen disappears. At no point does MysQL appear in the Task Manager.

    The original, clean installation of MySQL ‘essential’ seemed fine and I got the >msql prompt but something occurred after a day or two to create this error. Even when it was working, no PHP ‘connect’ scripts worked and a similar ‘can’t connect’ error message appeared.

    I have tried uninstalling and reinstalling the ‘essential’ package and other versions of MySQL but get the same error. I don’t seem to get a ‘clean’ reinstallation because the installation still refers to some files left behind – ‘Start Service’ and ‘Apply Security Settings’ are now greyed out on the final MySQL install screen as if they still exist. Various combinations of install options all yield the same result.

    The problem would appear to be a corrupt MySQL installation, a ‘dirty’ reinstall, a conf. file setting or perhaps a problem with Apache.

    I have been through the sections on the MySQL manual that refer to this error but the symptoms seem to be different here and none of the suggestions apply. ‘phpinfo’ lists MySQL but with ‘no value’ against host, password, port, socket and user. The ‘my.ini’ in the Windows folder seems correct.

    In the Win 98 ODBC settings the computer name is ‘localhost’ and the Port No., 1433. Using the correct U/N and PWD to connect to the SQL server, an error – SQL state: 01000; Server Error: 10061, TCP/IP sockets open – connect; Connection failed, SQL state: 08001, SQL Server Error: 11, TCP/IP General Network error.

    I can’t see any reference to ‘hosts’ in the System 32 folder but there is a ‘hosts.sam’ under Windows that lists ‘localhost

    Any help to get past this roadblock would be more than welcome.


    Martin Evers

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    Have you checked the MySQL help file, I think the 2003 error means that the client can't find the the server. IE the server is either not active or not accepting connections.
    First off are you sure the server is alive or started on boot up? - not sure how you do that in Windows (I only use MySQL on Linux so can't help there).
    You could try running MySQL admin or dbTools to check the server is active.
    Localhost is always on IP4 systems, PLEASE don't change it!
    I though MySQL always tried to use port 3306 (or that may be the Unix/Linux port).

  3. #3
    Join Date
    Jun 2005

    MySQL 5.1 for Windows install not complete

    the windows remove/install facility in the control panel doesn't work 100%

    theory: uninstall all you can and then use the repair option

    the port is indeed 3306 to be allowed in any firewall

  4. #4
    Join Date
    Feb 2008
    Bandung - Indonesia
    THe cause of that troubles are:
    1. Mysql (server) service is not running.
    2. Why it doesn't run? maybe your user table on mysql database is corrupt.

    Just reinstall...
    Forum Informatika - Indonesian Informatics Online Community -

Posting Permissions

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