apparmor阻止mysql启动

我正在运行Ubuntu 12.04,并将/ var / lib / mysql的mysql服务器的数据目录(保留相同的所有权和许可)移动到/etc/mysql/my.cnf中的/ u / apps / mysql,然后我更新了/ etc /apparmor.d/usr.sbin.mysqld包括:

/u/apps/mysql r, /u/apps/mysql/** rwk, 

但得到的错误:

 InnoDB: Reading tablespace information from the .ibd files... 130906 13:55:31 InnoDB: Operating system error number 13 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. InnoDB: File name . InnoDB: File operation call: 'opendir'. InnoDB: Cannot continue operation. 

所以我禁用了apparmor并开始。 它看起来像要打开的目录是'。' 我假设会是/ u / apps / mysql,但显然不是。 由于改变apparmorconfiguration它肯定会进一步,但我不知道它是什么窒息。 任何想法是怎么回事? 谢谢…

看来你有MySQL的datadir权限问题

  130906 13:55:31 InnoDB: Operating system error number 13 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. 

你可以更改datadir的权限,也可以将所有权更改为mysql。 一旦完成,就重新启动Mysql。

以及我不知道为什么apparmor在原始条目是“/ var / lib / mysql / ** rwk”和/ u / apps / mysql明确拥有mysql时,会在“/ u / apps / mysql / ** rwk” .mysql,但是当我将设置更改为“/ u / apps / ** rwk”并且工作正常