Hello,
Can you please tell your MySQL server version(SELECT VERSION())? If you are using server version less than 5.1.49 then you will be hitting this server bug: http://bugs.mysql.com/bug.php?id=52711
This is the bug fix in server 5.1.49:
– Security Fix: Using EXPLAIN with queries of the form SELECT … UNION … ORDER BY (SELECT … WHERE …) could cause a server crash. (Bug #52711, CVE-2010-3682)
Refer: http://dev.mysql.com/doc/refman/5.1/en/news-5-1-49.html
When you executed in command line you did not encounter “Lost Connection To Mysql Server During Query” because EXPLAIN SELECT was not included in the query. If the Profiler is ON and when you run the query, EXPLAIN SELECT is executed.
You can verify this by including EXPLAIN SELECT query in command line 🙂 .
Regards,
Ashwin A