首页 > 解决方案 > MySQL 不允许写入文件系统

问题描述

我在我的 Ubuntu 机器上运行 MariaDB 服务器mysql Ver 15.1 Distrib 10.1.44-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2。尝试在自定义数据目录中创建新表时DATA DIRECTORY='/home/myuser/ext',MySQL 错误日志告诉我

7f70acb77700  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.

mysqld 以 mysql 用户身份运行:

PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
30450 mysql     20   0  695572 206208  16432 S   0,0  1,3   0:43.48 mysqld

数据目录归mysql用户所有:

$ ls -l
drwxr-xr-x 4 mysql  mysql     4096 Feb 13 11:16 ext

原始数据目录的所有权和权限:

$ ll /var/lib/mysql/
total 1355856
drwxr-xr-x  7 mysql mysql       4096 Feb 13 12:00 ./

apparmor 显然没有干扰。内容/etc/apparmor.d/usr.sbin.mysqld

# This file is intensionally empty to disable apparmor by default for newer
# versions of MariaDB, while providing seamless upgrade from older versions
# and from mysql, where apparmor is used.
#
# By default, we do not want to have any apparmor profile for the MariaDB
# server. It does not provide much useful functionality/security, and causes
# several problems for users who often are not even aware that apparmor
# exists and runs on their system.
#
# Users can modify and maintain their own profile, and in this case it will
# be used.
#
# When upgrading from previous version, users who modified the profile
# will be promptet to keep or discard it, while for default installs
# we will automatically disable the profile.

/etc/apparmor.d/local/usr.sbin.mysqld不存在。

我在这里没有想法......还能是什么?

标签: mysqldatabasemariadbubuntu-18.04create-table

解决方案


推荐阅读