If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Error 2003 – Can’t Connect to MySQL Server on ‘Localhost’.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-04, 13:45
warthog warthog is offline
Registered User
 
Join Date: Dec 2004
Posts: 1
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 127.0.0.1.

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

Thanks

Martin Evers
Reply With Quote
  #2 (permalink)  
Old 12-05-04, 02:52
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
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 127.0.0.1 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).
Reply With Quote
  #3 (permalink)  
Old 12-22-08, 21:51
landonkelsey landonkelsey is offline
Registered User
 
Join Date: Jun 2005
Posts: 21
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
Reply With Quote
  #4 (permalink)  
Old 01-04-09, 09:44
galih galih is offline
Registered User
 
Join Date: Feb 2008
Location: Bandung - Indonesia
Posts: 15
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 - http://if.web.id
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On