0

I just updated a LAMP development machine from Ubuntu 11.04 to 12.04 When trying to run my php app I got the following error:

SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query

My app makes intensive use of stored procedures for dealing with database operations but it never thrown this error. After some research I realized that it happened when using the 5.5 version of MySQL. I also tested all failing procedures in mysql workbench and they work just fine.

Could this be a PDO problem? Did somebody got the same problem?

I worked this around using mysql sandbox, but I'd like to use mysql 5.5

My current versions are:

  • PHP: 5.3.10
  • Mysql: 5.5.24
algm
  • 109
  • 5
  • check wait_timeout value is set ? If not set it to some appropriate value wait_timeout=60 in your my.cnf file. – metalfight - user868766 Nov 01 '12 at 12:50
  • Could you check /var/log/mysql.err and /var/log/mysql.log and see if there is anything obvious. There have been known bugs with PDO on windows and intermittent problems in older versions of php but i'm not aware of anything in 5.3 – Joe Meyer Nov 01 '12 at 12:56
  • I set wait_timeout to a number of values but it did nothing. I also checked out the log files you suggested, Joe, but they are clean. – algm Nov 01 '12 at 14:58
  • possible duplicate http://stackoverflow.com/questions/1884859/lost-connection-to-mysql-server-during-query – luchosrock Apr 10 '13 at 19:00

2 Answers2

0

As the answer to the duplicate question I commented up, you should try starting the mysql service (mysqld) with --log-warnings=2 option and check what's the real issue in hostname.err file

luchosrock
  • 712
  • 10
  • 24
-2

Finally the issue was resolved after more than a year. We resolved it by changing the results fetching algorithm in our own code. Originally we used PDOStatement::fetchAll with PDO::FETCH_ASSOC to fetch results, it now uses the PDOStatement::fetch method in a loop with PDO::FETCH_NUM.

algm
  • 109
  • 5