I have some C++ applications that access our MySQL database via unixODBC on Ubuntu 10.04.

Once every few weeks for the last several weeks, I've seen this error appear in our error logs:

[unixODBC][MySQL][ODBC 3.51 Driver]Lost connection to MySQL server at 'reading initial communication packet', system error: 9

It originates from the ODBC library I use in my C++ code, and apparently comes from the ODBC driver.

Otherwise, the system works fine, processing thousands of queries a day. Can anyone shed light on what this might indicate, how to diagnose, what to check next?

Does anyone know where exactly this error code originates from and how I might look up what "9" means?

Edit: I will also add this is a local server, i.e., the MySQL server is running on the same machine as the C++ code.

  • I've started getting this recently as well. Did you find a resolution to your issue? – tkcsam May 6 '14 at 17:26

It means "bad file number": http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html

Basically, the socket was invalid when the driver attempted to communicate with it. Usually this is a networking issue, but I've only seen cases where this happened every time rather than very sporadically.

If you're able to reproduce this somehow it'd shed some light onto the cause, but since your application is working it'd be difficult to track.

  1. Is your environment up to date? Can you replicate it and confirm the error?

  2. Can you build an Ubuntu 12.04 environment and reproduce the error?

If the answer to both of these is "yes", consider filing a bug either on Launchpad or with the UnixODBC project directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.