New installation of 11.04. Then I followed all instructions here: http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-11.04-lamp

Now when I run mysqld I get this error:

makara@rahu:~$ mysqld
111103 13:39:37 [Warning] Can't create test file /var/lib/mysql/rahu.lower-test
111103 13:39:37 [Warning] Can't create test file /var/lib/mysql/rahu.lower-test
mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
111103 13:39:37 [ERROR] Aborting
111103 13:39:37 [Note] mysqld: Shutdown complete

Someone on IRC said it might be a package issue??

Thanks beet


mysqld should be ran as the mysql user. You should not run the daemon manually. Better start it as service like this:

sudo service mysql start

The error message points out that the mysql service cannot access certain files which it should not be allowed to acces in your user environment. So this behaviour should be correct. However, you should check whether the directories exist and who owns them and who has access to them (use ls -la for this purpose):

ls -la  /var/lib/
ls -la  /var/lib/mysql
  • Doesn't work. An output is mysql: unrecognized service – Green Jul 19 '13 at 16:20

I ran into the same issue, after the upgrade from Oneiric to Precise, which upgrades MySQL from 5.1 to 5.5.

In my case, the problem was that


was missing, even though it was included from


by default. A simple

sudo touch /etc/apparmor.d/local/usr.sbin.mysqld

solved the issue for me.

For those searching: the logfile that holds the interesting information is /var/log/upstart/mysql. There will be nothing in /var/log/mysql(*|/*)

What you see may include:

  • sudo service mysql start results in

    start: Job failed to start

  • Manually trying to start mysqld as a regular user will fail as usual (before the issue above comes into play), because the user doesn't have access to /var/lib/mysql (this can be found in the syslog).

  • Starting mysqld as root will succeed (I don't know why)

  • 1
    death to apparmor ... didn't even know this existed, yet it caused my a couple hours of pain – sbditto85 Aug 20 '13 at 0:37

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.