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

Source: Internet
Author: User
Tags mysql manual php website

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

 

You are using a Windows operating system. This error is related to a registry key value tcptimedwaitdelay.
Reduce the tcptimedwaitdelay time in Windows to solve this problem. The default value is 240 (this value is also not set)
This setting needs to be set in the following location of the Registry.
HKEY_LOCAL_MACHINE/system/CurrentControlSet/services/TCPIP/parameters/tcptimedwaitdelay
If the registry does not contain the tcptimedwaitdelay project, add the project and set it to the dual-byte (DWORD) type.
Set the value to 30 ~ Between 60

 

Reprinted statement:This article from http://www.devdao.com/Article/384352.htm

========================================================== ======================================

 

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

Original Source: http://www.hao32.com/webserver/55.html
Can't connect to MySQL server on 'localhost' (10048), which is generally seen on Windows 2003 Server using MySQL.

Cause of the error:

ApplicationProgramYou need to quickly release and create new connections, but the time_wait connection exceeds the default value, resulting in low throughput.

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 0 × 0000001e.
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.

 

Reprinted statement:This article from http://www.ismole.net/thread-997-1-1.html

========================================================== ======================================

 

MySQL, errors detailed solution Summary

Recently, the server database collapsed from time to time and was depressed. I found a lot of methods and did not solve them. Convert these methods.
After the server is started for a period of time, MySQL will automatically fail ~ The problem can be solved only after restart. We recommend that you use mysql4.x for beginners. 5 is indeed not perfect. In addition, this problem cannot be solved simply. I hope other friends who have encountered this problem can be inspired by the help ~~~
Description 1:
Server configurations: win2003, serv-u6.0, mysql-4.0.24, php-4.3.11, SQL2000
After the server runs for a period of time, the PHP website cannot be opened, and the error "can't connect to MySQL server on 'localhost' (10055)" is returned. Restarting the MySQL service does not work, but only the server is restarted. However, this error occurs several days later.

My. ini configuration content:
# This file was made using the winmysqladmin 1.4 Tool
#2005-6-26 16:53:57

# Uncomment or add only the keys that you know how works.
# Read the MySQL manual for instructions

[Mysqld]
Basedir = C:/MySQL
# Bind-address = 192.168.13.81
Datadir = C:/MySQL/Data
# Language = C:/MySQL/share/your language directory
# Slow query log # =
# Tmpdir # =
# Port = 3306
# Set-variable = key_buffer = 16 m
[Winmysqladmin]
Server = C:/MySQL/bin/mysqld-nt.exe
User = root
Password = %
--------------------------------------------------------------------------------

Description 2:
Can't connect to MySQL server on 'localhost' (10055) (2003)
Can't connect to MySQL server on 'localhost' (10048) (2003)

my system is 2003, and the above error occurs repeatedly in MySQL for a while .... restart, but the problem is coming again after a while... research Direction

description 3:
my MySQL has always encountered an error recently and the 'localhost' (10055) error is prompted! The following message is displayed:
--------------------------------------------------------------------------------
MYSQL: Ready for connections
MYSQL: ready for connections
Cannot initialize InnoDB as 'innodb _ data_file_path 'is not set.
if you do not want to use transactional InnoDB tables, add a line
skip-InnoDB
to the [mysqld] section of init parameters in your my. CNF
or my. ini. if you Want to use InnoDB tables, add to the [mysqld]
section, for example,
innodb_data_file_path = ibdata1: 10 m: autoextend
but to get good performance you shoshould adjust for your hardware
the InnoDB startup options listed in section 2 at
http://www.innodb.com/ibman.html
050621 13:25:20 MYSQL: normal shutdown
050621 13:25:20 MYSQL: shutdown complete
MYSQL: Ready For connect Ions
--------------------------------------------------------------------------------
what does it mean? In addition, you must restart the machine after each error. It is useless to restart the MySQL service.

Solution reference (online)
I:
I think it may be that some of the main program writing problems, may occupy the connection but not disconnect. In addition, does the MySQL server have a firewall installed? In particular, the Norton Firewall, I once met that it clearly allowed my IP address to access the protected server. However, after a while, Norton thought that my IP address was an illegal attack, the IP address is automatically blocked. Wait for 20 minutes (the default rule), or restart the server .......

II:This item is used with caution. After I change it, viview always has internal server errors.
You are using a Windows operating system. This error is related to a registry key value tcptimedwaitdelay. Reduce the tcptimedwaitdelay time in Windows to solve this problem. The default value is 240 (this value is also not set ). This setting must be set at the following location in the Registry: hkey_local_machinesystemcurrentcontrolsetservicestcpipparameterstcptimedwaitdelay
If the registry does not contain the tcptimedwaitdelay project, add the project and set it to the dual-byte (DWORD) type. Set the value to 30 ~ Between 60.

III:
After the Server FTP test is completed, restart it. Everything is stable. However, there are still a few questions that have not been clarified. Don't worry.

1. When the FTP pressure was not high last Friday and more than 900 people were online for 30 minutes, the 10% error of MySQL connection failure occurred at a rate of 10048.
2. The connection method I used at the time was mysql_connect (). Server IIS + PHP + ISAPI. After referring to some materials, I immediately changed the mysql_connect () method to the mysql_pconnect () method. At that time, the problem seemed to be resolved.
3. On Saturday, the server started the FTP stress test. A 15% error occurred when MySQL connection fails at a rate of 10048. The error code is 10055 more than the previous one.

Key unknown 10048 10055 ErrorCodeError message. It should be said that no definite answer is found to the question.

I opened Serv-U and had four socket connections. MySQL immediately went to the Data Mining Institute.

IV:
Can't connect to MySQL server on 'localhost' (10048)
Can't connect to MySQL server on 'localhost' (10055)
MySQL 4.0.13-NT

Server: Windows2000 Server + iis5.0 + PhP ISAPI + MySql

I developed a web site using PHP + MySQL, which has a high access volume.
However, after more than a week of normal operation, the can't connect to MySQL server on 'localhost' (10048) error is frequently reported.

The statistical data is as follows:
10,594 Failed Connections
Total connections per hour: 885.37
% 15.91%

We can see that the connection failure rate is very high. It should be emphasized that there was no such high error rate in the same number of links a week ago.

Cause Analysis: using the fport tool, you will find that someone is exhausting your database connection. Obviously, their feature is that dozens of connections come from the same IP address, all of which are time-waitk

Solution:1. We recommend that you modify the maximum number of connections, or change the mysql_connect () method to the mysql_pconnect () method,
2. Block these IP addresses. If an IP address is greater than 3, It is abnormal.
3. Fix the problem and modify the website program. Refresh is prohibited too quickly!
Note: you can block the local port 3306 from the firewall!

 

Reprinted statement:This article from http://bbs.bokecc.com/viewthread.php? Tid = 76307

========================================================== ======================================

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.