Can't connect to MySQL server on 'localhost' (10048), which is generally seen on windows 2003 server using mysql.
Cause of the error:
Applications need to be quickly released and create new connections. However, because the connections in TIME_WAIT exceed the default value, the throughput is low.
Solution:
Two windows registry keys closely related to this error: TcpTimedWaitDelay and MaxUserPort.
TcpTimedWaitDelay determines the time required before a TCP/IP Address can release closed connections and reuse its resources. the time interval between disabling and releasing is generally referred to as the TIME_WAIT status or twice the maximum segment lifecycle (2MSL) status. during this period, the cost of re-opening a connection to the client and server is less than creating a new connection. reduce the value of this entry to allow TCP/IP to release closed connections more quickly and provide more resources for new connections.
MaxUserPort determines the maximum number of ports used by the system to request any available user ports. The maximum port number that can be specified by TCP/IP. if the maximum port number of a TCP connection is greater than 5000, the Local Computer returns the following error message WSAENOBUFS (10055): the system does not have enough buffer or cannot perform socket operations because the queue is full, as a result, the 10048 error of the application is caused.
Open Registry Editor regedit
TcpTimedWaitDelay settings:
Find the HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ TCPIP \ Parameters registry subkey
Create a new REG_DWORD value named TcpTimedWaitDelay.
Set this value to decimal 30, and the hexadecimal value to 0x0000001e.
The waiting time for this value is 30 seconds.
Default value of this item: 0xF0 (hexadecimal). The waiting time is set to 240 seconds.
MaxUserPort settings (add the maximum port connection ):
Find the HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ TCPIP \ Parameters registry subkey
Create a new REG_DWORD value named MaxUserPort
Set this value to a minimum value of 32768 in decimal format.
The waiting time for this value is 30 seconds.
Restart windows.
The default value of this item is 5000 (decimal)
Close Registry Editor and restart windows.