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

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
earlati
Posts: 18
Joined: Thu 18 Nov 2004 07:37
Location: Bergamo / Italy

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

Post by earlati » Fri 18 May 2012 14:58

On a single server I have a group of programs connected to a mysql server using MyDAC.
All the programs works well despite, from time to time, all the programs, at the same time, can no more access the mysql database.
The error reported on my logs are like this:

[17/05/2012 14.06.31] [ThrID=0908] [TThreadPMV::InitPMV]ERRORE Can't connect to MySQL server on 'localhost' (10061)

Socket error on connect. WSAGetLastError return 10048($2740)


To solve the problem I have to close all the programs , and sometimes also the mysql db, and after that I restart te programs and all goes well again.

It's seem that for some reason the mydac goes out of work and I want to check what should cause such problem.
Mybe my programs require to much resources to mydac but I didn't kwnow how to check this.
Where can I search to find if mydac has reached some limits or have some internals errors ?

I have BCB 6 with mydac 4.3 and mysql 5.0

Rgards, E. Arlati

AndreyZ

Re: Can't connect to MySQL server on 'localhost' (10061)

Post by AndreyZ » Mon 21 May 2012 10:25

Hello,

This problem can occur under Windows. The point is that after a port is closed, it will not be available again until TIME_WAIT expires (by default, 120 seconds). You can find more detailed information about such Windows behaviour and the way to avoid it here:
http://dev.mysql.com/doc/refman/5.5/en/ ... on-windows
http://bugs.mysql.com/bug.php?id=6580
http://bugs.mysql.com/bug.php?id=10498

Post Reply