Can ' t connect to the MySQL server on ' localhost ' (10048) problem Solving method _mysql

Source: Internet
Author: User
Resolves can ' t connect to MySQL server ' localhost ' (10048), commonly seen in Windows 2003 servers using MySQL.

Why the error occurred:

Applications need to quickly release and create new connections, but because the connections that exist in time_wait exceed their default values, they result in lower throughput.

Solution:
Registry entries for two windows that are closely related to this error: Values for TcpTimedWaitDelay and MaxUserPort.

TcpTimedWaitDelay determines the time that TCP/IP must elapse before it can release a closed connection and reuse its resources. This interval between shutdown and release is generally known as the time_wait state or twice times the maximum segment life cycle (2MSL) state. During this time, the cost of reopening the connection to the client and server is less than establishing a new connection. Reducing this value allows TCP/IP to release closed connections more quickly and to provide additional resources for new connections.

MaxUserPort determines the maximum number of ports to be used when requesting any available user ports from the system, and the highest port number that TCP/IP can specify. If you establish a TCP connection with a maximum port connection greater than 5000, the local computer responds to the following error message Wsaenobufs (10055): Because the system lacks enough buffers or because the queue is full and cannot perform operations on the socket, the application's 10048 errors are caused.

Open Registry Editor regedit

TcpTimedWaitDelay settings:
Locate the Hkey_local_machine\system\currentcontrolset\ Services\Tcpip\Parameters registry subkey
and create a new REG_DWORD value named TcpTimedWaitDelay
Set this value to decimal 30, hexadecimal to 0x0000001e
The wait time for this value will be 30 seconds.
Default value for this entry: 0xF0 (16), wait time set to 240 seconds

MaxUserPort settings (Increase maximum port connection):
Locate the Hkey_local_machine\system\currentcontrolset\ Services\Tcpip\Parameters registry subkey
and create a new REG_DWORD value named MaxUserPort
Set this value to decimal minimum 32768
The wait time for this value will be 30 seconds.
Reboot the Windows system.
Default value for this entry: 5000 (decimal)

Close the Registry Editor and restart the Windows system.

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.