mysql 5.7.17数据目录与fedora

时间:2016-12-28 23:33:50

标签: mysql fedora selinux

出于某种原因,每当我在更改数据目录(遵循此处的说明:http://www.thegeekstuff.com/2016/05/move-mysql-directory/comment-page-1/)之后启动mysql时,我都会看到此错误。

2016-12-28T23:12:48.369028Z 0 [Note] InnoDB: Loading buffer pool(s) from /data/mysql/var/lib/mysql//ib_buffer_pool
2016-12-28T23:12:48.369217Z 0 [ERROR] InnoDB: Cannot open '/data/mysql/var/lib/mysql//ib_buffer_pool' for reading: Permission denied
2016-12-28T23:12:48.369344Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-12-28T23:12:48.377825Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-12-28T23:12:48.378334Z 0 [Note] IPv6 is available.
2016-12-28T23:12:48.378352Z 0 [Note]   - '::' resolves to '::';
2016-12-28T23:12:48.378370Z 0 [Note] Server socket created on IP: '::'.
2016-12-28T23:12:48.378770Z 0 [ERROR] Could not create unix socket lock file /data/mysql/var/lib/mysql/mysql.sock.lock.
2016-12-28T23:12:48.378779Z 0 [ERROR] Unable to setup unix socket lock file.
2016-12-28T23:12:48.378783Z 0 [ERROR] Aborting

我检查了我的审核报告,看它是否报告了某些权限问题,我什么都没看到:

[root@RCOVLNX3081 ~]# cat /var/log/audit/audit.log |  grep ib_buffer_po
[root@RCOVLNX3081 ~]# cat /var/log/audit/audit.log |  grep mysql.sock.lock
[root@RCOVLNX3081 ~]#

我还检查了文件的安全上下文,并确保mysql_db_t可以访问该文件

[root@RCOVLNX3081 ~]# ls -RZ /data/mysql/var/lib/ | grep ib_buffer_pool
-rw-r-----. mysql mysql unconfined_u:object_r:mysqld_db_t:s0 ib_buffer_pool

强制我更改权限的任何权限问题:

[root@RCOVLNX3081 ~]# chcon -Rt mysqld_db_t /data/mysql/var/lib/mysql
[root@RCOVLNX3081 ~]# ls -RZ /data/mysql/var/lib/ | grep -v mysqld_db_t
/data/mysql/var/lib/:

/data/mysql/var/lib/mysql:

/data/mysql/var/lib/mysql/mysql:

/data/mysql/var/lib/mysql/performance_schema:

/data/mysql/var/lib/mysql/sys:

仍然是同样的错误。请帮忙。

这是my.cnf文件的内容:

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock

datadir=/data/mysql/var/lib/mysql
socket=/data/mysql/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

0 个答案:

没有答案