Ubuntu 9.10 修改 MySQL 的 datadir

2014-11-24 17:42:55 · 作者: · 浏览: 0

Nov 7 10:41:25 agroom mysqld: 091107 10:41:25 [Warning] Can't create test file /home/mysql/agroom.lower-test


Nov 7 10:41:25 agroom kernel: [ 2806.844060] type=1503 audit(1257561685.971:187): operation="mknod" pid=5620 parent=5506 profile="/usr/sbin/mysqld" requested_mask="w::" denied_mask="w::" fsuid=0 ouid=0 name="/home/mysql/agroom.lower-test"


...


Nov 7 10:41:26 agroom mysqld: InnoDB: The error means mysqld does not have the access rights to


Nov 7 10:41:26 agroom mysqld: InnoDB: the directory.


Nov 7 10:41:26 agroom mysqld: InnoDB: File name ./ibdata1


Nov 7 10:41:26 agroom mysqld: InnoDB: File operation call: 'open'.


Nov 7 10:41:26 agroom mysqld: InnoDB: Cannot continue operation.


Nov 7 10:41:26 agroom kernel: [ 2806.902273] type=1503 audit(1257561686.031:190): operation="open" pid=5620 parent=5506 profile="/usr/sbin/mysqld" requested_mask="rw::" denied_mask="rw::" fsuid=113 ouid=113 name="/home/mysql/ibdata1"


应该是与权限有关, 更像是与某种安全机制有关. ubuntu 9.10默认未启用SELinux, 但是好像有个apparmor. 这时想起my.cnf里有段注释:


[mysqld]


#


# * Basic Settings


#


#


# * IMPORTANT


# If you make changes to these settings and your system uses apparmor, you may


# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.


#


查看/etc/apparmor.d/usr.sbin.mysqld, 的确是一些目录的权限设置. 照样加入/home/mysql. 重启成功