解决ERROR 1030 (HY000): Got error 168 from storage engine

建表时指定另外一个目录,结果出错:

mysql>  create table t1 (id int primary key,n varchar(10)) data directory='/home/mysql/data';
ERROR 1030 (HY000): Got error 168 from storage engine

在error log中有这样的提示:

2020-01-16T02:29:45.360317Z 2 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-01-16T02:29:45.360400Z 2 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.

以为是mysqld的权限不对,改了也没有用:

mysql> system sudo -u mysql touch  /home/mysql/data/a
mysql>  create table t1 (id int primary key,n varchar(10)) data directory='/home/mysql/data';
ERROR 1030 (HY000): Got error 168 from storage engine

到处搜索,发现上apparmor惹得祸,

# aa-status| grep mysql
   /usr/sbin/mysqld
   /usr/sbin/mysqld (15007) 

修改配置文件把相应的目录加上即可: /etc/apparmor.d/usr.sbin.mysqld

发布了17 篇原创文章 · 获赞 2 · 访问量 863
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览