Go Premium for a chance to win a PS4. Enter to Win


ERROR 2003 (HY2003): Can't connect to MySQL server on 'localhost' (10061)

Posted on 2006-11-09
Medium Priority
Last Modified: 2012-06-21
EE Experts:

I know that there are about 10 answered questions in the EE knowledge base with this or similar title, but so far none of them have a solution that I have been able to make work for whatever reason (most of those asking the questions left out some of their important details of implementation of the answers). It appears that there are 2 methods for establishing a connection from a client, like mysql, to connect to a process running as a service like mysqld-nt: through local host (IP or through named pipes.

Here is my situation and what I have. I'm trying to run mysqld-nt server version 5.0.19-nt (community something) as a Windows service and my preferred way of connecting to it would be localhost IP; but at this point I would take whatever I can get working. I'm trying to install my "proof of concept" VB.NET application that uses MySQL via ADO.NET unbound controls as an RDBMS running as a service on the client machine. I have done 4 or 5 practice installs onto Windows XP Pro machines and Windows 2000 Pro machines without any problem -- everything works and I'll give more details later. The database installs without incident and everything works. I'm now trying use the same install software components on a CD that I have burned and used successfully to install the application on a laptop that has Windows XP Home Edition for an Operation System and the RDBMS doesn't work. I get either the message in the question title or "Can't Open named pip to host pipe:mysql(2)t ". I get that one when I have selected not to use TCP/IP in the MySQLInstanceConfig.exe program.

When I try to run the client "mysql" in a DOS window, it just blows right off because it can't connect to the server running in the backgound as a service. I have uninstalled and reinstalled the MySQL software probably at least 5 times now trying various combinations as I go. I have also tried to run the server in the foreground in a DOS window using the command line "mysqld-nt --enable-named-pipe". At this point the hostname,err file in the Drive:\Program Files\MySQL\MySQL Server 5.0\data folder says: . . . I can't say what it says because I have uninstalled and deleted all the folders and files. I'll do it again if I need to in response to a request for information.

I can see from the responses to other same questions in the EE knowledge base that MySQL has been made to work with Windows XP Home Edition. Any suggestions..?? I hope I can get something that works soon or I'm going to have to loan my client my laptop that has XP Pro on it to take to a convention to show some of his associates what we have so far as proof of concept for my program that about 20 people have expressed an interest in purchasing.


Question by:Ted Palmer

Author Comment

by:Ted Palmer
ID: 17911946
EE Experts:

Additional Information: I can ping localhost and get a good response on the Windows XP Home machine -- the bad boy. Localhost connectivity is what I was using on all the installs that I had that worked. That has to be since I checked the checkbox for TCP on the MySQLInstanceConfig.exe program and the mysqld-nt service was not started with the command line parameter --enable-named-pipe.


LVL 35

Accepted Solution

Raynard7 earned 800 total points
ID: 17912078
Hi, a few questions - 1.why are you using the version stated - 5.0.28 is out and is much more stable.
2. Is there any reason why you are not using tcp ip connections and only using named pipes?
3. Have you been able to access the server through any other options - ie creating a DSN/ using the mysql query browser / sqlyog
4. Have you tried connecting with "localhost" rather than - what port are you trying to connect to?
5. What installer option did you choose?

I only ask these qeustions as I have installed 5.0 on many XP home machines, have never had a problem with any of them connecting via tcpip using the msi installer  -  they interface with c# apps that I have written without any worries.

Author Comment

by:Ted Palmer
ID: 17913027

Thanks for your reply. I'm not going to try to answer all your questions right now, but thank you for asking them. I just woke up (it's 03:25 AM here) and remembered that there were 2 elements of information that I should have included in my question. I'd better write them down now before I forget them again.

The database engine that I'm using is InnoDB and . . . . I forgot the other. It'll come to me later. Maybe after posting this I'll fall asleep for a couple of hours then wake up again and post it to this question.

On the version issue, I'm using "mysqld-nt server version 5.0.19-nt". I hope that a version difference that small from version 5.0.28 would not be a cause of the probelm I'm having.

On the TCP issue, I ment to say that TCP/IP was my preferred method, but I tend to be very verbose. So my explanation of my situation may have not been perfectly clear because of all the language artistry crap I write. Yes, all of my previous installs to non-Home Edition OSs were using the TCP option of the MySQLInstanceConfig.exe program Wizard. I am very encouraged to know that you "installed 5.0 on many XP home machines, have never had a problem". Knowing that helps me a lot.

On the mysql query browser issue. No I have not tried that yet. I have not been using that program made available from MySQL AB. I use TOAD for MySQL from Quest Software. TOAD is an acronym for Tool for Oracle Application Developers and TOAD ROCKS. It started off as freeware and now sells for $1,200 to $1,500 a copy for the commercial versions. I'll spare everybody my sermon about how great TOAD is for now, but it has become so popular amongst Oracle developers that Quest has ported it to Microsoft SQL Server, DB2, and the MySQL port is free. I'll post the link where to get it latter. I wasn't going to try using a database browser when at this point I can't even connect using the mysql client.

On the 'Have you tried connecting with "localhost" rather than' question. the answer is yes.

On the "What installer option did you choose?" question. I'll list my installer option choices when I wake up again. I gotta go back to bed now.

On named pipes issue. I tried using the --enable-named-pipe command line option in a DOS compatibality window to run the server. It didn't work and that is one where I had already did the uninstall when I thought about posting it so the hostname.err log file was not available. I also tried using this option by starting the service from the property window you get by right clicking the service using the services program. The property window gives me an option to start the service and it also provides a text box for command line parameters. It didn't work either.

I gotta quit writing and go back to bed now.

Thanks for your reply.

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.


Author Comment

by:Ted Palmer
ID: 17913048
Oh, on "connecting via tcpip using the msi installer". I use the msi installer also. A . . . setup.exe for MySQL uses the msi installer and the Setup project in VB.NET 2003 creates a setup.exe for my client program that uses the msi installer.
LVL 29

Assisted Solution

fibo earned 800 total points
ID: 17913196
Can you access mysql and its data from a dos box?

Author Comment

by:Ted Palmer
ID: 17913444

The answer to your question "Can you access mysql and its data from a dos box?" is no. I would be more elaborative but I should be in bed and maybe so should you. I'll respond better latter, but thank you for your interest.


Author Comment

by:Ted Palmer
ID: 17913461

I can't tell where you are at geographicly. I'm in St. Louis, Missouri, USA. You might be on the other side of the world and it is high noon there or something.

LVL 29

Expert Comment

ID: 17913664
Hi Ted,
I'm in Marseille in Southern France and here it 1:30 pm.

If you cannot access mysql from a command-line... probability seems high that mysql is not running, or at least not as it should. Check with windows task-manager and with services if mysql is running or not.

Have a nice sleep! Things that take 1hour of brian at 1am take 5 minutes at 9am...

Author Comment

by:Ted Palmer
ID: 17913861

Yes I have looked at that. More of the story. After I complete the MySQLInstanceConfig.exe Wizard program at the end of the installation process, my server is running in the background as a service. I can see it in Task Manager, but I can't talk to it from the mysql client. I don't remember the error message. Oh. The error message is in the title. That is what I get. So my server is running. It also says that it was "Started" in the Status column in the Services program. If I stop it. I can't restart it. Well maybe I can if I just stop and restart it, but I have usually tried to restart it using the --enable-named-pipe command line parameter. It doesn't restart. I don't recall what the error message is in hostname.err file. I'll have to go through that process again and make a better record of the results. Once I have done that, it is hosed. It won't do anything after that.

Thanks for your reply,

LVL 13

Assisted Solution

kawas earned 400 total points
ID: 17915559

Author Comment

by:Ted Palmer
ID: 17916164

The installation options that I am selecting are these:

Setup Type: Custom

Custom Setup -- Select the program features you want installed.

I take the defaults; i.e. everything but Developer Components
Install to: C:\Program Files\MySQL\MySQL Server 5.0\

Ready to Install the Program
Setup Type:
Destination Folder:
   C:\Program Files\MySQL\MySQL Server 5.0\

Click: <<Install>>

MySQL.com Sign-Up
   Skip Sign-UP

Wizard Completed

I leave checked the checkbox Configure the MySQL Server now
Click: <<Finish>>

Welcome to the MySQL Server Instance Configuration Wizard 1.0.8
Click: <<Next>>

Please select a configuration type.
I leave checked radiobutton Detailed Configuration

Configure the MySQL Server 5.0 instance.
I select RadioButton Server Machine. . . . MySQL will have medium memory usage.

Please select the database usage.
I select RadioButton Transactional Database Only . . . . InnoDB the main storage engine. . . .

InnoDB Tablespace Settings
Please choose the drive and directory where the InnoDB tablespace should be placed.

I choose C:\MySQL Datafiles\

Please set the approximate number of concurrent connections to the server.

I leave the default RadioButton Decision Support (DSS)/OLAP selected . . . . A number of 20 connections will be assumed.

Please set the networking options.
I leave checked checkbox Enable TCP/IP Networking . . . . When disabled, only local connections through named pipes are allowed.

I leave the port Number value at 3306

I leave checked checkbox Enable Strict Mode . . . . forces the server to behave more like a traditional database server. . . .

Please select the default character set
I leave RadioButton Standard Character Set selected . . . . Makes Latin1 the default character

Please set the Windows options.
I leave checked checkbox Install As Windows Service
Service Name: MySQL
I leave checked checkbox Launch the MySQL Server automatically
I check checkbox Include Bin Directory in Windows PATH

Please set the security options.
I leave checked checkbox Modify Security Settings
New root password: root
Confirm: root

I plan to later change the password to no password. For now this is only a "proof of concept" application that runs on a laptop for demo purposes.

Ready to execute . . . . Please press [Execute] to start the configuration
I click <<Execute>>

Processing configuration
I get blue check marks in circles in front of:
O Prepare configuration
O Write configuration file (C:\Program Files\MySQL\MySQL Server 5.0\my.ini)
O Start Service
X Apply security settings gets no blue check mark and a dialog box pops up with the title bar text of
"Connection Error"
Dialog box text is too big to enter it all but the most important part is
The security settings could not be applied to the database because the connection has failed with the following error.

Error Nr. 2003
Can't connect to MySQL server on 'localhost' (10061)

If a personal firewall is running on your machine, please make sure you have opened the TCP port for 3306 for connections. . . .

Click "Retry" or "Skip". I click "Skip".

After clicking "Skip" the
O Apply security settings has a little red 'x' in it and I get the following error message:

The security settings could not be applied.
Error Number 2003.
Can't connect to MySQL server on 'localhost' (10061)

At this point I click <<Cancel>>
This is the same thing that I get when installing to my Windows 2000 Pro and Windows XP Pro machines, but after this is complete I can run the mysql client and connect to the database service without a password. I can do a SHOW DATABASES and see my databases. I do a USE DATABASE and SHOW TABLES. I can do a SELECT COUNT(*) FROM tablename and get a reasonable value for the number of rows returned. My VB.NET application will work with this since I have a hard coded connect string of user ID = root without a password. Life is good at this point. On my client's laptop running XP Home, I can't do any of those things. Life is BAD.

Oh for fibo's benefit: I can see mysql-nt.exe in Task Manager and in the Services Window it shows MySQL status as "Started"

My client's laptop has Norton Internet Security. . . . !@#$%^&*()_+ God Damn it! That was it. This has cost me so much time. I was about to say that I checked the Norton Internet Security configuration and it shows loopback to 'localhost' permitted in the firewall rules for both IN and OUT directions. Not wanting to mess with my client's firewall rules, I left it like that thinking that it was OK. IT WAS NOT OK. I just now disabled Norton Internet Security and I can now connect to my mysqld-nt service running in the background with a blank password. I just finished installing my application using the setup.exe created by my VB.NET project within my VB.NET solution and it works also.


I would not have gotten to this point were it not for this discussion. I will be awarding points shortly. Also Kawas. I see your reply while I was typing all this BS (That is American English for Boloney Sausage -- believe that do ya..??) I haven't seen your website contribution, but I'm sure that it will have some value for me.

Thanks Guys. . . . Thanks a LOT..!!

LVL 29

Expert Comment

ID: 17916400
Glad it worked. Sorry I did not think about this FW problem... I had had it and searched a long time before finding the solution.
Thx for the points!

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month6 days, 2 hours left to enroll

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question