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 :)

Edit: I tried using tcp protocol instead of a local socket, like described here. Unfortunately, it changed nothing.

Any idea anyone of you?


I too have an Ubuntu 12.04 LTS server running on a virtualised system provided by a competitively priced German hosting company.

Yesterday (28th September), I noticed that disk I/O was very slow. Running iotop showed mysqld to be the most likely culprit. Checking /var/log/syslog showed the same messages as in your log files being repeated every 2 minutes - indicating that the mysqld process was continually being attempting to be respawned.

I stopped the myslqd service using sudo service mysql stop. However, ps showed that I still had another mysqld process running: one that I had manually started a few weeks ago with the --skip-grant-tables option when I needed to reset the root password but I had forgot to stop the process after having reset the password. Unfortunately, while manually stopping this process, I suffered my first kernel crash on this server but after re-starting the server, the problem had resolved itself.

Having doing more research, it seems that it's an AppArmor issue. As I'm new to Ubuntu Server I don't know much about AppArmor but this question seems to be relevant to the issue.

* BTW, this is my first ever answer on a StackExchange site. I hope that it's of use and in compliance with the community's etiquette. Any feedback will be appreciated.

| improve this answer | |
  • Hi Anthony, great, thank you for your (great first ;) ) answer. It's a little bit curious, because i only saw one mysqld running when I checked that with ps aux | grep mysql. Anyway, thank you very much for the link, I will check that as soon as possible and give you more feedback :) – bully Sep 29 '12 at 15:25
  • Hi Anthony, thanks for the link, it was pretty useful for me. Though, after all, I needed to re-install the whole system anyway, so I couldn't figure that out. Though, after setting up the system again, the error didn't occure any more. – bully Oct 1 '12 at 14:38
  • Glad to hear you got it sorted in the end. – Anthony Geoghegan Oct 2 '12 at 17:17

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.