Welcome 微信登录

首页 / 数据库 / MySQL / Ubuntu 下修改 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" name="/usr/sbin/mysqld" 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" name="/home/mysql/n1.lower-test" 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" name="/home/mysql/n1.lower-test" 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" name="/home/mysql/mysql/plugin.frm" 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" name="/home/mysql/ibdata1" 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 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2MySQL使用大全-从基础到存储过程MySQL 存储过程变量拼接相关资讯      MySQL数据库教程 
  • MySQL 处理非法数据  (04/09/2013 08:06:28)
  • MySQL关于timestamp和mysqldump的  (12/16/2012 13:25:41)
  • MySQL保证数据完整性  (12/16/2012 12:00:35)
  • ERROR 1130: mysql 1130连接错误的  (12/16/2012 13:29:08)
  • MySQL数据库教程:管理数据库和表(  (12/16/2012 12:47:02)
  • MySQL快速插入大批量数据存储过程  (11/05/2012 19:04:04)
本文评论 查看全部评论 (0)
表情: 姓名: 字数