无法在 Arch Linux 上设置 MariaDB / mysql_install_db 权限被拒绝

无法在 Arch Linux 上设置 MariaDB / mysql_install_db 权限被拒绝

设置 MariaDB 时遇到问题。我正在跟进Arch Linux |玛丽亚数据库

我在 Arch Linux 上安装了 MariaDBsudo pacman -S mariadb

我创建了一个/mnt/local/int001/MEDIA/Personal/DB具有权限的新文件夹:

drwxrwsr-x+ 1 mysql mysql                232 Jul 13 14:34  DB

我添加datadir = /mnt/local/int001/MEDIA/Personal/DB/etc/mysql/my.cnf

我将我的用户添加到mysql用户组sudo usermod -a -G mysql myuser

然后我尝试sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/mnt/local/int001/MEDIA/Personal/DB按照建议运行,但出现以下错误。任何想法为什么我得到这个即使mysql拥有所有权。

编辑:我已经将权限更改为 777,没有什么区别。

编辑:我的系统上没有 SELinux 的痕迹。

编辑:有 ACL,但我已将它们从父级中删除(并且递归地)。

编辑:我已更改为SU mysql并且可以编辑此路径中的文件。

Installing MariaDB/MySQL system tables in '/mnt/local/int001/MEDIA/Personal/DB' ...

2018-07-13 14:52:02 140714278559680 [Note] /usr/bin/mysqld (mysqld 10.1.34-MariaDB) starting as process 12074 ...
2018-07-13 14:52:02 140714278559680 [ERROR] mysqld: Can't create/write to file '/mnt/local/int001/MEDIA/Personal/DB/aria_log_control' (Errcode: 13 "Permission denied")
2018-07-13 14:52:02 140714278559680 [ERROR] mysqld: Got error 'Can't create file' when trying to use aria control file '/mnt/local/int001/MEDIA/Personal/DB/aria_log_control'
2018-07-13 14:52:02 140714278559680 [ERROR] Plugin 'Aria' init function returned error.2018-07-13 14:52:02 140714278559680 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: The InnoDB memory heap is disabled
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: Compressed tables use zlib 1.2.11
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: Using Linux native AIO2018-07-13 14:52:02 140714278559680 [Note] InnoDB: Using SSE crc32 instructions
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: Completed initialization of buffer pool
2018-07-13 14:52:02 140714278559680 [Note] InnoDB: Highest supported file format is Barracuda.
2018-07-13 14:52:03 140714278559680 [Note] InnoDB: 128 rollback segment(s) are active.
2018-07-13 14:52:03 140714278559680 [Note] InnoDB: Waiting for purge to start
2018-07-13 14:52:03 140714278559680 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.39-83.1 started; log sequence number 1600627
2018-07-13 14:52:03 140713784243968 [Note] InnoDB: Dumping buffer pool(s) not yet started
2018-07-13 14:52:03 140714278476544 [Warning] Failed to load slave replication state from table mysql.gtid_slave_pos: 1146: Table 'mysql.gtid_slave_pos' doesn't existERROR: 1  Can't create/write to file '/mnt/local/int001/MEDIA/Personal/DB/mysql/db.MYI' (Errcode: 13 "Permission denied")
2018-07-13 14:52:03 140714278559680 [ERROR] Aborting

答案1

只是猜测,但尝试放宽对父目录的权限,我前段时间就见过这种行为。如果我没记错的话,这是由于“太严格”的权限造成的。第二次猜测,您是否尝试在路径中添加“尾部斜杠”?

答案2

尝试在该路径上添加递归权限,以便 mysqld 可以访问它。

chmod -R <permissions> <path>

同样可以适用于chown -R

另外,添加文件系统信息也会有所帮助。

相关内容