RedHat: /usr/sbin/mysqld: Can’t change dir to ‘/appl/mysql/’ (Errcode: 13 – Permission denied)

I am setting up Mysql on an EC2 Redhat 7 machgine.

I changed the default MySQL datadir to a new mount path /appl. When trying to start MySQL, I am getting the following error.


2016-09-12 04:34:59 0 [Note] /usr/sbin/mysqld (mysqld 5.6.33) starting as process 18131 ...

2016-09-12 04:34:59 18131 [Warning] Can't create test file /appl/mysql/ip-10-4-4-53.lower-test

2016-09-12 04:34:59 18131 [Warning] Can't create test file /appl/mysql/ip-10-4-4-53.lower-test

/usr/sbin/mysqld: Can't change dir to '/appl/mysql/' (Errcode: 13 - Permission denied)

2016-09-12 04:34:59 18131 [ERROR] Aborting
2016-09-12 04:34:59 18131 [Note] Binlog end

2016-09-12 04:34:59 18131 [Note] /usr/sbin/mysqld: Shutdown complete
160912 04:34:59 mysqld_safe mysqld from pid file /var/run/mysqld/ ended

How to solve this issue.


Flash Asked on September 12, 2016 in Tools & Automation.
Add Comment
1 Answer(s)

It could be SELinux problem.

Check if SELinux is enabled is using the following command.


It should give an output like the following. If the status parameter is enabled and “Current Mode” is enforcing, it means SElinux is blocking your MySQL daemon operations.

SELinux status: enabled

SELinuxfs mount: /sys/fs/selinux

SELinux root directory: /etc/selinux

Loaded policy name: targeted

Current mode: enforcing

Mode from config file: enforcing

Policy MLS status: enabled

Policy deny_unknown status: allowed

Max kernel policy version: 28

You need to Set SELinux to permissive mode. Open the SELinux config file

sudo vi /etc/sysconfig/selinux

Change the “SELINUX=enforcing” parameter to “SELINUX=permissive” and save the SeLinux configuration file as shown below.

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

# enforcing - SELinux security policy is enforced.

# permissive - SELinux prints warnings instead of enforcing.

# disabled - No SELinux policy is loaded.


# SELINUXTYPE= can take one of these two values:

# targeted - Targeted processes are protected,

# minimum - Modification of targeted policy. Only selected processes are protected.

# mls - Multi Level Security protection. SELINUXTYPE=targeted

Now reboot the server for the changes to take place properly.
Start the mysql service after the reboot. It should work fine.

Thor Answered on September 12, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.