Can't connect to MySQL server on 'localhost' (10048) Solution

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.