WhiteSites Blog

How to Fix MySQL Error 10055

Posted on Sep 5, 2013 by Paul White

Before launching a new social networking website for my client I had some doubts on if my server could handle it.  The old site was primitive by today's standards.  The new site was full of AJAX calls that would refresh elements on the page behind the scenes.  However this was bound to put my Database Server under a heavier load than it was used to.

After launching the new site everything was going well.  But once our members starting loggin in, we started to get this error from all sites on the box.

ERROR HY000 MySQLODBC 5.1 DriverCan't connect to MySQL server on 'localhost' (10055) ERROR HY000 MySQLODBC 5.1 DriverCan't connect to MySQL server on 'localhost' (10055)

Background on my Server

Dual 3.6 Ghz Intel Xeons ( 90 nm )
4 x 146GB 15K SAS Drives in RAID 10 on a Dedicated RAID Controller with 256 MB RAM
16 GB Memory

Software
Windows Server 2008 R2
SmarterMail
SmarterStats
MySQL 5.1
Running about 80 Websites.

What is the Cause of MySQL Error 10055?

The truth is this is more of an Operating System Error than a MySQL error.  Each time your website runs a query you open a connection to the Database, run the query, then close the connection.  Each time this happens your Server allocates a dynamic port for use by MySQL and your Website.  For Websites like mine which may run 2000+ Queries per second, this means that 2000+ dynamic ports must be set asside for these connections.  Sometimes your server gets under load and the operating system can't recycle these ports fast enough, leading you to run out of ports and then your server throws a 10055 Error.  

By default Windows Server 2008 R2 has 16838 Ports designated for Dynamic use.  The default ranges are 49152 - 65535.  However this can be extended to a wider range of ports.

How to Fix MySQL Error 10055

To fix the problem you need to increase the number of dynamic ports.
Running the following Commands will give give you 50000 ports for dynamic use.

On Windows Server 2008 R2
Open command Prompt

Type the following
netsh int ipv4 set dynamicport tcp start=10000 num=50000
Press Enter

Type the following
netsh int ipv4 set dynamicport udp start=10000 num=50000
Press Enter

Type the following
netsh int ipv6 set dynamicport tcp start=10000 num=50000
Press Enter

Type the following
netsh int ipv6 set dynamicport udp start=10000 num=50000
Press Enter

Conclusion

Every Since running these commands, I haven't had a single instance of MySQL 10055 Errors.
Hope this helps others with similar problems.


Permalink
32542 Visitors
32542 Views

Categories associated with How to Fix MySQL Error 10055

Discussion

Shahzad Khan | Dec 6, 2015 8:10 AM

Hi,

Thanks for sharing this article, you saved me from a big trouble and actualling bringing up my server without silly re-installations and setups.

I would like to know if there are any security or DDOS potential threats by increasing the number of dynamic ports for tcp and udp.

Best Regards,

Paul | Dec 6, 2015 9:41 AM

Shahzad,

I don't think increasing the number of dynamic ports would be any kind of security threat.  The biggest threat is each MySQL connection is going to use a set amount of memory for over head.  If your system gets under load and can't close out connections fast enough, this will evetually use up all available dynamic ports, or system memory, after which your applications will start saying "Can't connect to MySQL server".  To help cut down the chances of this happening, I recommend you cache your DB calls when you can.  Upgrading your hardware to SSD based storage also helps.

Radu-Cristian Neagoe | Jul 20, 2017 8:04 AM

Hi,

Thank you for this, I was having the same issue when connecting to a MySQL database installed on a Microsoft Server 2008 R2 server and I could not find any visible root causes. Trying to connect via HeidiSQL yielded the error 10055 which led me to this page.

I hope anybody having a similar issue cand find this solution easily.

Have a great life!

Adriano | May 18, 2018 2:19 PM

Thank you. It works like a chars.

name
Email Needed to confirm comment, but not made public.
Website
 
 
When you Post your Comment, you'll be sent a confirmation link. Once you click this link your thoughts will be made public.. Posts that are considered spam will be deleted, Please keep your thoughts and links relavent to this Article