2003
Can ' t connect to MySQL server on ' localhost ' (10048)
Typically seen in Windows 2003 servers using MySQL.
Reason for the occurrence of the error:
The first reason:
The application needs to quickly release and create new connections, but lower throughput due to the presence of connections in time_wait that exceed the default values.
Solution:
Two windows registry entries that are closely related to this error: TcpTimedWaitDelay and MaxUserPort values.
TcpTimedWaitDelay determines the time that TCP/IP must pass before it can release a closed connection and reuse its resources. This interval between closing and releasing is known as the time_wait state or twice times the maximum segment life cycle (2MSL) state. During this time, reopening the connection to the client and the server costs less than establishing a new connection. Reducing this value allows TCP/IP to release closed connections more quickly, providing more resources for new connections.
MaxUserPort determines the maximum number of ports that TCP/IP can specify when requesting any available user ports from the system. If you establish a TCP connection with a maximum port connection greater than 5000, the local computer responds with the following error message Wsaenobufs (10055): Because the system lacks sufficient buffers or because the queue is full, the socket operation cannot be performed, resulting in an application 10048 error.
Open Registry Editor regedit
TcpTimedWaitDelay settings: Found
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters the registry subkey and creates a key namedNew REG_DWORD value for TcpTimedWaitDelaySet this value to decimal 30, and hexadecimal to 0x0000001e the value wait time will be 30 seconds. Default value for this item: 0xF0 (16 binary), wait time set to 240 seconds
MaxUserPort settings (Increase maximum port connection): Found
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters the registry subkey and creates a key namedNew REG_DWORD value for MaxUserPort Set this value to the decimal lowest 32768 The value wait time will be 30 seconds. Restart the Windows system. Default value for this entry: 5000 (decimal)
Close Registry Editor, restart the Windows system.
(Hkey_local_machine\system\currentcontrolset\services\tcpip\parameters\tcptimedwaitdelay
If this item is not tcptimedwaitdelay in the registry, increase this item and set it to double-byte (DWORD) type numeric value set to 30 ~ 60 )
Another reason is
About can ' t connect to mysql server on ' localhost (10048)
This bug appears in a loop, Once every run, the mysql database is connected once. The
does not appear in my own windowx xp , but it appears in windows 2003 server, x32. .
because Win32po will have a delay every time release rtand close p ort . To cause this bug. The
can look at the following forum discussion:
http://bugs.mysql.com/bug.php?id=6580
and Microsoft's solution for this bug ... Very troublesome ... How does
http://support.microsoft.com/kb/q196271/
work?
As long as you remove mysql_close () . only at the end of program put a mysql_close () can solve this problem.
Resolve 2003 Can ' t connect to MySQL server on ' localhost ' (10048)