MySQL 5.5 - Lost connection to MySQL server during query

Posted by bully on Ask Ubuntu See other posts from Ask Ubuntu or by bully
Published on 2012-09-21T06:12:41Z Indexed on 2012/09/21 9:50 UTC
Read the original article Hit count: 715

Filed under:

I have an Ubuntu 12.04 LTS server running at a german hoster (virtualized system).

# uname -a 
Linux ... 3.2.0-27-generic #43-Ubuntu SMP Fri Jul 6 14:25:57 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

I want to migrate a Web CMS system, called Contao. It's not my first migration, but my first migration having connection issues with mysql.

Migration went successfully, I have the same Contao version running (it's more or less just copy / paste).

For the database behind, I did:

apt-get install mysql-server phpmyadmin

I set a root password and added a user for the CMS which has enough rights on its own database (and only its database) for doing the stuff it has to do. Data import via phpmyadmin worked just fine.

I can access the backend of the CMS (which needs to deal with the database already).

If I try to access the frontend now, I get the following error:

Fatal error: Uncaught exception Exception with message Query error: 
Lost connection to MySQL server during query (<query statement here, nothing special, just a select>) thrown in /var/www/system/libraries/Database.php on line 686

(Keep in mind: I can access mysql with phpmyadmin and through the backend, working like a charme, it's just the frontend call causing errors).

If I spam F5 in my browser I can sometimes even kill the mysql deamon.

If I run

# mysqld --log-warnings=2

I get this:

120921  7:57:31 [Note] mysqld: ready for connections.
Version: '5.5.24-0ubuntu0.12.04.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
05:57:37 UTC - mysqld got signal 4 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.

It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346679 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f1485db3b20
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f1480041e60 thread_stack 0x30000

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f1464004b60): is an invalid pointer
Connection ID (thread ID): 1

From /var/log/syslog:

Sep 21 07:17:01 s16477249 CRON[23855]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Sep 21 07:18:51 s16477249 kernel: [231923.349159] type=1400 audit(1348204731.333:70): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=23946 comm="apparmor_parser"
Sep 21 07:18:53 s16477249 /etc/mysql/debian-start[23990]: Upgrading MySQL tables if necessary.
Sep 21 07:18:53 s16477249 /etc/mysql/debian-start[23993]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
Sep 21 07:18:53 s16477249 /etc/mysql/debian-start[23993]: Looking for 'mysql' as: /usr/bin/mysql
Sep 21 07:18:53 s16477249 /etc/mysql/debian-start[23993]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Sep 21 07:18:53 s16477249 /etc/mysql/debian-start[23993]: This installation of MySQL is already upgraded to 5.5.24, use --force if you still need to run mysql_upgrade
Sep 21 07:18:53 s16477249 /etc/mysql/debian-start[24004]: Checking for insecure root accounts.
Sep 21 07:18:53 s16477249 /etc/mysql/debian-start[24009]: Triggering myisam-recover for all MyISAM tables

I'm using MyISAM tables all over, nothing with InnoDB there. Starting / stopping mysql is done via

sudo service mysql start
sudo service mysql stop

After using google a little bit, I experimented a little bit with timeouts, correct socket path in the /etc/mysql/my.cnf file, but nothing helped. There are some old (from 2008) Gentoo bugs, where re-compiling just solved the problem. I already re-installed mysql via:

sudo apt-get remove mysql-server mysql-common
sudo apt-get autoremove
sudo apt-get install mysql-server

without any results.

This is the first time I'm running into this problem, and I'm not very experienced with this kind of mysql 'administration'.

So mainly, I want to know if anyone of you could help me out please :)

Is it a mysql bug? Is something broken in the Ubuntu repositories? Is this one of those misterious 'use-tcp-connection-instead-of-socket-stuff-because-there-are-problems-on-virtualized-machines-with-sockets'-problem? Or am I completly on the wrong way and I just miss-configured something? Remember, phpmyadmin and access to the backend (which uses the database, too) is just fine. Maybe something with Apache? What can I do?

Any help is appreciated, so thanks in advance :)

© Ask Ubuntu or respective owner

Related posts about mysql