Can't start server: Bind on TCP/IP port: No such file or directory (some progress)

Back in October last year I wrote about a peculiar MySQL error message:

Can't start server: Bind on TCP/IP port: No such file or directory

This error only seems to occur on Windows (Server 2003 in this case). While the first part is clear - a port could not be bound, because it was already occupied by another process - the second part does not make any sense.

We got in contact about this with MySQL support recently, because we came across the problem again on a machine that had received the "treatment" described in the earlier article which did not seem to work. Turned out that server had not been rebooted ever since, so the registry change was never activated.

However as a nice side-effect we now know (almost for sure) what that strange "No such file or directory" is all about: see MySQL Bug #33137. It has been categorized as a feature request - I doubt it will get any serious attention soon. So I will just summarize here to have it all in one place.

Apparently when the bind() call that is issued on MySQL server startup fails, on Linux and other platforms the cause for that failure can be queried from the error number (errno) return value. This does not seem to be the case on Windows. According to Axel Schwenke of MySQL support's research this is well documented on the MSDN reference of the Winsock bind function. According to that errno is not set to any meaningful value as a result of the bind() call. Instead you are advised to use WSAGetLastError() to find out if your call succeeded or what went wrong.

MySQL currently does not follow that advice, so the error displayed (errno=ENOENT=-1) does not have anything to do with the bind call at all. As a matter of fact there is currently no way to tell what really happened when that call failed. The only "real world" reason that comes to mind is in fact - as mentioned above - another process already occupying that port.

Be sure, should that feature request ever be implemented, you will find the (final) post about it here :)


Popular posts from this blog

SAXParseException: -1:-1: Premature End Of File - Misleading error

Amiga 500 Restoration: A501 Memory Expansion

Something to know about Toshiba external USB HDD