时间:2021-07-01 10:21:17 帮助过:27人阅读
新安装完Ubuntu 9.10, 想把MySQL的datadir设为/home/mysql. 修改my.cnf后, 重启失败. 查系统日志, 有如下记录:Nov 7 10:41:25 a
新安装完Ubuntu 9.10, 想把MySQL的datadir设为/home/mysql. 修改my.cnf后, 重启失败. 查系统日志, 有如下记录:
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
...
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
应该是与权限有关, 更像是与某种安全机制有关. 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. 重启成功
,