0

tl;dr: Every SQL query of length 64 or higher that is a multiple of 32 results in the connection closing with a 2013 error when interacting with our remote MySQL server.

I am having the strangest issue with our MySQL database. For background, it is running MySQL v5.6 on a remote server hosted by Network Solutions which our IT requires us to use. As such, privileges are really lacking. I can create, read, update, and delete databases, tables, columns, rows, etc., but I can't do things like restarting the server or defragging. I don't believe our IT has access to do so either and this is just a Network Solutions thing.

When updating some values, I noticed that some queries were causing a MySQL 2013 error which is

Lost connection to MySQL server during query.

Those queries would continue to fail on retries, and past successes would still succeed. I realized that the common factor was that the failed queries all had a total length of 64, ex.

SELECT code FROM my_database WHERE assignee = 'abcde@gmail.com'

Also noticed that it will continue to error out if the length is any other multiple of 32, except for 32 itself. The assignee in this instance can theoretically be any length up to 50, so the query can always theoretically be a multiple of 32 no matter how I format it.

I've tried with different tables, databases, and clusters and they all have the same issue. Also tried running the queries on a different computer. Strangely, phpMyAdmin does everything just fine.

The only solution I have right now is to check assignee length and change the query accordingly so that it isn't going to fail but this is a lot of work to put in place for every single SQL statement I have written in our systems.

This might be an issue to bring up with Network Solutions but they have been extremely unhelpful in the past when it comes to technical issues and I don't even know where to start on telling them how to fix it.

  • Tough one. 5.5 is quite old. Upgrade to 5.6 or 5.7 or 8.0. – Rick James Sep 10 at 16:48
  • 1
    @RickJames Server is currently running MySQL 5.6. Don't think I can get it upgraded to anything beyond that. – JAB Sep 10 at 17:00
  • You could use Wireshark and/or tcpdump to record both good and bad sessions and compare. However, since as you say "phpMyAdmin does everything just fine", the problem is likely in the application or ORM framework that issues those queries. – mustaccio Sep 10 at 18:29

Your Answer

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

Browse other questions tagged or ask your own question.