Getting Error - Could not open file '/mysql/<db_name>/logs/<db_name>.err' for error logging: Permission denied:
If you are implementing systemctl to start, stop, and check status of mysqld and getting following error, while starting mysqld service, then check whether SeLinux is disabled or not.
mysqld[44278]: 2018-11-06T01:36:48.303642Z 0 [ERROR] [MY-010187] [Server] Could not open file '/mysql/<db_name>/logs/<db_name>.err' for error logging: Permission denied
mysqld[44278]: 2018-11-06T01:36:48.303785Z 0 [ERROR] [MY-010119] [Server] Aborting
Disable SeLinux:
Check whether SeLinux is enforcing or permissive
# getenforce
Enforcing
Edit file /etc/sysconfig/selinux and set SELINUX=permissive as follows and REBOOT server
# cat /etc/sysconfig/selinux
# 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.
#SELINUX=enforcing
SELINUX=permissive
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
Execute following command to make sure SeLinux is permissive
#getenforce
Permissive
Explore more at -
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/security-enhanced_linux/sect-security-enhanced_linux-working_with_selinux-changing_selinux_modes
https://docs.fedoraproject.org/en-US/Fedora/11/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Enabling_and_Disabling_SELinux.html
If you like to configure SELINUX and keep enforcing SELINUX - Explore it at https://blogs.oracle.com/jsmyth/selinux-and-mysql
If you have an access to Oracle - MOS - Refer: How to set SELinux contexts for MySQL Server (Doc ID 2296123.1) to configure SELinux for MySQL database server.
If you are implementing systemctl to start, stop, and check status of mysqld and getting following error, while starting mysqld service, then check whether SeLinux is disabled or not.
mysqld[44278]: 2018-11-06T01:36:48.303642Z 0 [ERROR] [MY-010187] [Server] Could not open file '/mysql/<db_name>/logs/<db_name>.err' for error logging: Permission denied
mysqld[44278]: 2018-11-06T01:36:48.303785Z 0 [ERROR] [MY-010119] [Server] Aborting
Disable SeLinux:
Check whether SeLinux is enforcing or permissive
# getenforce
Enforcing
Edit file /etc/sysconfig/selinux and set SELINUX=permissive as follows and REBOOT server
# cat /etc/sysconfig/selinux
# 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.
#SELINUX=enforcing
SELINUX=permissive
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
Execute following command to make sure SeLinux is permissive
#getenforce
Permissive
Explore more at -
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/security-enhanced_linux/sect-security-enhanced_linux-working_with_selinux-changing_selinux_modes
https://docs.fedoraproject.org/en-US/Fedora/11/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Working_with_SELinux-Enabling_and_Disabling_SELinux.html
If you like to configure SELINUX and keep enforcing SELINUX - Explore it at https://blogs.oracle.com/jsmyth/selinux-and-mysql
If you have an access to Oracle - MOS - Refer: How to set SELinux contexts for MySQL Server (Doc ID 2296123.1) to configure SELinux for MySQL database server.
Comments
Post a Comment