Home >Database >Mysql Tutorial >Ubuntu 下修改 MySQL 库文件目录不能启动

Ubuntu 下修改 MySQL 库文件目录不能启动

WBOY
WBOYOriginal
2016-06-07 17:13:411406browse

/var的目录过小,按照公司的安装习惯,将mysql 的 datadir切换到 /home/mysql,发现无法启动,日志中出现:

/var的目录过小,按照公司的安装习惯,,将mysql 的 datadir切换到 /home/mysql,发现无法启动,日志中出现:

Apr 30 21:56:03 n1 kernel: [41411.680225] init: mysql post-start process (31902) terminated with status 1
Apr 30 21:56:03 n1 kernel: [41411.691791] type=1400 audit(1335794163.366:298): apparmor="STATUS" operation="profile_replace" pid=31935 comm="apparmor_parser"
Apr 30 21:56:03 n1 kernel: [41411.707244] type=1400 audit(1335794163.382:299): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" pid=31939 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Apr 30 21:56:03 n1 kernel: [41411.707381] type=1400 audit(1335794163.382:300): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" pid=31939 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
Apr 30 21:56:03 n1 kernel: [41411.711149] type=1400 audit(1335794163.386:301): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/mysqld" pid=31939 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=107 ouid=107
Apr 30 21:56:03 n1 kernel: [41411.736333] type=1400 audit(1335794163.410:302): apparmor="DENIED" operation="open" parent=1 profile="/usr/sbin/mysqld" pid=31939 comm="mysqld" requested_mask="rw" denied_mask="rw" fsuid=107 ouid=107

原来是 apparmor 做了限制。AppArmor 是内核的一个安全增强模块,对程序存取资源进行限制。解决方法:

vi /etc/apparmor.d/usr.sbin.mysqld

/home/mysql/ r,
/home/mysql/** rwk,
重新启动mysql,正常。

更多Ubuntu相关信息见Ubuntu 专题页面 ?tid=2

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn