reading initial communication packet', system error: 0

I am getting the following error when trying to remotely connect to my MySQL server.

Unable to connect to host, or the request timed out.

Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).

MySQL said: Lost connection to MySQL server at 'reading initial communication packet', system error: 0

I am logging in using SSH:

#Update 1#

I experience this on all of my Digital Ocean droplets (since 2014). Rebooting the server solves the problem. Sometimes I have to reboot the server several times before the error vanishes and I can log in.

#Update 2# It only happens through SSH login.

If I login using remote IP, user and password I can connect just fine.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

It might be the firewall problem or maybe because the MySQL server is bound to the loop-back IP ( / localhost) which effectively cuts you off from connecting from “outside”.

If this is the case, you need to upload the script to the web server (which is probably also running the MySQL server) and keep your server host as ‘localhost’.