mysql 5.7.17 data directory different from default on fedora
<p>For some reason I am seeing this error whenever I to startup mysql after changing the data directory (followed instructions here: <a href="http://www.thegeekstuff.com/2016/05/move-mysql-directory/comment-page-1/" rel="nofollow noreferrer">http://www.thegeekstuff.com/2016/05/move-mysql-directory/comment-page-1/</a>) to something different.</p>

<pre><code>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
</code></pre>

<p>I checked my audit report to see if it reported something for those permissions issues and I see nothing:</p>

<pre><code>[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 ~]#
</code></pre>

<p>I also checked the security context for the files and made sure that the mysql_db_t had access to the file</p>

<pre><code>[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
</code></pre>

<p>to force any permissions issues with the permissions i changed:</p>

<pre><code>[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:
</code></pre>

<p>Still the same error. Please help.</p>

<p>here is the content of my.cnf file:</p>

<pre><code># 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
</code></pre>