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

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群版 2核4GB 100GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: 建表时指定另外一个目录,结果出错

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


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


或者disable mysqld的


sudo ln -s /etc/apparmor.d/usr.sbin.mysqld  /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld 
Skipping profile in /etc/apparmor.d/disable: usr.sbin.mysqld
相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
3月前
|
存储
tracker_query_storage fail, error no: 28, error info: No space left on device
tracker_query_storage fail, error no: 28, error info: No space left on device
84 0
|
3月前
|
Kubernetes 容器 Perl
error: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is cu
error: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is cu
66 0
|
3月前
|
关系型数据库 MySQL 数据安全/隐私保护
MySQL连接ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password‘ cannot be loaded
MySQL连接ERROR 2059 (HY000): Authentication plugin ‘caching_sha2_password‘ cannot be loaded
75 0
|
网络安全 Docker 容器
failed to create network error response from daemon filed to setup ip tables问题
failed to create network error response from daemon filed to setup ip tables问题
170 0
|
9月前
Error from server error dialing backend remote error tls internal error
Error from server error dialing backend remote error tls internal error
69 0
|
关系型数据库 MySQL 数据安全/隐私保护
MySQL:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
MySQL:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
127 0
|
SQL 数据库 Windows
SQL Server 2005 sp_send_dbmail出现Internal error at FormatRowset (Reason: Not enough storage is available to complete this operation)
案例环境:   操作系统: Windows 2003 SE 32bit(SP2) 数据库版本:Microsoft SQL Server 2005 - 9.00.5069.00 (Intel X86)             Aug 22 2012 16:01:52           ...
1405 0