I recently had a issue getting MySQL to read a specific database. Each time I tried to manually query a table in the database, I received the following error message:
ERROR 1018 (HY000): Can't read dir of './default/' (errno: 13)
I’ve seen this message before as it means that there is a permissions issue. I checked the ownerships and permissions, and everything seemed to be in order.
The only thing special about this database is that I have it symlinked to another partition. This has always worked in the past, so I was stumped.
The problem turned out to be that Ubuntu has AppArmor. This software sets up rules that prevent software from gaining access to different areas of the file system. In my case, AppArmor was preventing read and write access to the actual location of my database files.
The solution was quite easy: First, I added the path that I wanted MySQL to have access to in the AppArmor configuration file for MySQL. Second, I restarted the apparmor service. Here’s the technical details:
- On my system, the configuration file that controls MySQL permissions through AppArmor are located at
/etc/apparmor.d/usr.sbin.mysqld
. The following shows the contents of the file as it now exists:# vim:syntax=apparmor # Last Modified: Tue Jun 19 17:37:30 2007 #include /usr/sbin/mysqld { #include #include #include #include #include capability dac_override, capability sys_resource, capability setgid, capability setuid, network tcp, /etc/hosts.allow r, /etc/hosts.deny r, /etc/mysql/*.pem r, /etc/mysql/conf.d/ r, /etc/mysql/conf.d/* r, /etc/mysql/my.cnf r, /usr/sbin/mysqld mr, /usr/share/mysql/** r, /var/log/mysql.log rw, /var/log/mysql.err rw, /var/lib/mysql/ r, /var/lib/mysql/** rwk, /var/log/mysql/ r, /var/log/mysql/* rw, /var/run/mysqld/mysqld.pid w, /var/run/mysqld/mysqld.sock w, /home/sites/default/mysql/ rw, /home/sites/default/mysql/* rw, /sys/devices/system/cpu/ r, }
The two lines in bold show what I added to the configuation. The first line gives read and write access to the directory itself while the second gives read and write access to the files contained in the directory.
- After saving the configuration changes, I simply needed to restart the AppArmor daemon. I did this with the following command:
[chris@rommie ~]$ sudo service apparmor restart * Reloading AppArmor profiles Skipping profile in /etc/apparmor.d/disable: usr.bin.firefox
Did I help you?
hey chris, have you given 10.4 a swing yet? Karmic Koala was a disaster on my laptop, but this looks promising. Seem to have problems with embedded flash though. how are things looking for you?
I’ll have to do a post about my 10.4 experiences so far. In a nutshell, Ubuntu has never worked better on my Studio 17. The only problems I’ve had are 1) installing from scratch (not upgrading) works much better and 2) Flash is flakey at best.
I still have some issues but not nearly as many as I had with jaunty.
Almost everything works fine except for the fact that i have some internet connectivity issues over wifi and maximizing and unmaximizing windows causes 2-3 second lags.
I’m in the process of looking for workarounds for it.
Odd. I have neither of those issues.
My biggest issue is that I’m running 64-bit and Flash refuses to work properly on Firefox. It either doesn’t work at all or refuses to respond to mouse events. In addition, Flash always leaves gray blocks over content as I scroll. It’s quite maddening, so I use Chromium when I want to do something with Flash.
i’ve switched to chrome a while ago, due to the annoying sluggishness and memoryleaks in firefox. However the flash issues i had were fixed in both browsers as soon as i upgraded to the 10.04LTS.
The lag in the windowsresizing seems to be due to the ATI card. I don’t know what the deal is on my internet connection. It is strangaeh.
Man that flash thing used to annoy the hell out of me, hope you get that solved real soon!
Thanks! That was my problem too when I moved my mysql database.
And my ubuntu 10 is ok mostly, I have flash working fine, but I don’t have any sound.
THANK YOU! Problem solved.