mysqld gives errcode:13 because it can't create test files
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
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
/etc/apparmor.d/local/usr.sbin.mysqld
was missing, even though it was included from
/etc/apparmor.d/usr.sbin.mysqld
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 instart: 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)
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