Mysql Error 10048
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Server Fault Questions Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Can't connect to MySQL server on 'localhost' (10048) up vote 1 down vote favorite 1 From what I can tell this is recent error that has started to occur on my localserver: Can't connect to MySQL server on 'localhost' (10048). My site will work for a while then it will randomly throw this error then start working again. Any advice on how to fix this? I have searched online and most people claim that it is a windows based error which needs a registry fix but I wanted to see if anyone else has encountered this issue and has any better advice? Thanks! mysql php share|improve this question asked Dec 31 '09 at 14:52 tempyAcc Which Windows edition are you using? –gekkz Dec 31 '09 at 15:13 add a comment| 7 Answers 7 active oldest votes up vote 1 down vote I'd suggest looking at the output of "netstat -ano" when this error occurs. If this is Windows Server 2003, the default ephemeral port range is only 1024-5000. If this port range is full, you won't be able to make new outbound connections, including "outbound" to localhost. You can get around this by changing the MaxUserPort setting in the registry, possibly along with the TCPTimedWaitDelay setting if netstat shows you have lots of connections in a TIME_WAIT state. 'netstat -ano |find /C ":"' will give you a (somewhat misleading) count of how many sockets are active. However, if you find this port range is all in use, as others mentioned, you may have an underlying issue with connections not being closed. This could be a code problem. Also, if you have your web server and your database server running on the same machine, you may
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > mysql error 10048 - how do we solve it Want to Advertise Here? Solved mysql error 10048 - how do we solve it Posted on 2008-09-26 MySQL Server 1 Verified Solution 20 Comments 1,951 http://serverfault.com/questions/98505/cant-connect-to-mysql-server-on-localhost-10048 Views Last Modified: 2008-12-06 mysql 10048 , how do we solve that error . what is the cause of this error 0 Question by:nabil_zakkak Facebook Twitter LinkedIn Google LVL 1 Best Solution byedcharleslynn We found the problem to be a windows issue. We resolved it by changing the maxuserports registry setting. It's documented in the mysql docs and worked like a charm for us on Windows https://www.experts-exchange.com/questions/23765797/mysql-error-10048-how-do-we-solve-it.html 2003 Server. Ps. Go to Solution 18 Comments LVL 5 Overall: Level 5 MySQL Server 1 Message Expert Comment by:vibrazy2008-09-26 Hi, I have found this in expert exchange. http://www.experts-exchange.com/Database/MySQL/Q_23215173.html 0 LVL 21 Overall: Level 21 MySQL Server 19 Message Active 4 days ago Expert Comment by:theGhost_k82008-09-26 You'r trying to access you mysql server from network and there may be some entries to my.cnf for restricting remote access. check mysql for : 1) skip-networking 2) bind-address=127.0.0.1 If any of that/they'r there remove//comment it. And restart mysql. May be firewall is stopping you to connect. 0 Message Author Comment by:nabil_zakkak2008-10-19 The problem is nothign to do with the server or mysql the problem when I have too many load on the database the database will refuse connection for 1 or 2 minutes and then will accept the connections. So the main problem is when the server is busy. Any suggestion 0 LVL 1 Overall: Level 1 MySQL Server 1 Message Expert Comment by:edcharleslynn2008-10-20 Found this on the net, it seems to offer a solution to the issue.: "The error is caused not by MySQL or the MySQL ODBC driver, but by the behaviour
Reporter: p t Email Updates: Status: Closed Impact on me: None Category:MySQL Server Severity:S1 (Critical) Version:MySql 4.0.24 OS:Microsoft Windows (XP SP2) Assigned to: View Add Comment Files Developer Edit Submission View Progress Log https://bugs.mysql.com/bug.php?id=10498 Contributions [10 May 2005 6:33] p t Description: The problem only occurs on Windows XP and 2003, but works fine on Windows 2000. We have tried using MySql Connector .NET 1.0.4, MySqlDriverCS and MYODBC 3.51, but none http://www.cryer.co.uk/brian/mysql/trouble_odbc_cant_connect_on_localhost.htm of them have resolved the problem. The Problem: The ASP.NET and Windows applications run fine at the start but after a while when too many queries are made it refuses to connect to mysql and MySql mysql error connector .NET gives me the following error "Unable to connect to any of the specified MySQL hosts". When this happens, if I try to login manually to mysql it says: "ERROR 2003: Can't connect to MySQL server on 'localhost' (10048)". After I leave it idle for a while it goes back to running fine but then crashes again when too much load is put on. Like I said at the start this is mysql error 10048 only an issue with Win XP and Win 2003, but not Win 2000. How to repeat: If using MySql Connector .NET, try the following code to connect to MySql public DataSet SelectQuery(string sql) { MySqlConnection conn = new MySqlConnection(); DataSet dset1 = new DataSet(); DataTable dtab1 = new DataTable(); MySqlDataAdapter da = new MySqlDataAdapter(); string connStr = "server=localhost;user id= USERNAME; password= PASSWORD; database=DotnetDB; pooling=false"; try { conn = new MySqlConnection(connStr); conn.Open(); da = new MySqlDataAdapter(sql,conn); conn.Close(); da.Fill(dset1); return dset1; } catch (MySqlException ex) { string temp = ex.ToString(); conn.Close(); return null; } } And then set up an infinite loop that calls the above function with a basic sql statement "Select * from DotnetDB" You must let it run for a while (say 50 seconds). Suggested fix: Unsure of the exact problem to offer any possible fix. [10 May 2005 6:35] p t I have also tried MySql 5.0 and still had the same problem [21 May 2005 5:04] Miguel Solorzano Please read the bug: http://bugs.mysql.com/bug.php?id=6580 then you will notice that isn't a MySQL issue. Thanks in advance. [21 Jun 2005 23:00] Bugs System No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and cha
ERROR [HY000] [MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'localhost' (10048) The precise presentation of this error may vary according to the software used, this wording was generated from an ASP.NET application. Other symptoms: The application has previously been able to successfully connect to the database. Waiting a minute or so, and the application can connect again without the error. The error seems to manifest itself under "stress" conditions, when lots of connections are being made opened and closed in a short space of time (minutes). These notes only apply to the error above when the "other symptoms" are present. Cause The error is caused not by MySQL or the MySQL ODBC driver, but by the behaviour of Windows. For performance reasons Windows maintains a connection on a TCP port after it is closed for (by default) 4 minutes. The advantage of this is that if the connection needs to be reopened it can be done at a lower cost. The trouble is that under heavy load when lots of connections are opened and closed to the database, the system can hit a limit on the maximum number of connections allowed (even though as far as the application is concerned these connections have been closed). Resolution To decrease the delay before Windows releases an open TCP connection, use regedit to edit the following registry value of: HKLM\ SYSTEM\ CurrentControLSet\ Services\ Tcpip\ Parameters\ TcpTimedWaitDelay This value does not exist by default and will need to be created. It should be a DWORD. The valid range is 0x1E - 0x12C (30seconds to 300 seconds), the default is 0xF0 (240 seconds). Decreasing the value of TcpTimedWaitDelay should help, but is unlikely to permanently solve the problem for a busy system (because if the system is busy the limits will still be hit). Consider whether it is possible to modify the application to re-use database connections instead of closing and reopening them. In theory enabling connection pooling would address this problem. For more information about connection pooling see http://support.microsoft.com/default.aspx?scid=kb;EN-US;q169470. To enable connection pooling for the MySQL driver: Start > Control Panel > Administrative Tools > Data Sources (ODBC). This will open up the "ODBC Data Source Administrator". On the "Connection Pooling" tab, double click the ODBC Driver you are using to connect to MySQL. This will open up the "Set Connection Pooling Attributes" dialog. To enable pooli