Skip to main content

Posts

Showing posts with the label socket

Set SELinux contexts for MySQL Server for datadir, logdir, errolog, pid, socket, port

Set SELinux contexts for MySQL Server for datadir, logdir, errolog, pid, socket, port: semange help: semanage -h semanage fcontext -h List the current MySQL contexts: #semanage fcontext -l | grep -i mysql List port available for MySQL: #semanage port -l | grep mysql Add port to mysqld template: #semanage -a -t mysqld_port_t -p tcp 3375 Add port range to mysqld template: #semanage port -a -t mysqld_port_t -p tcp 35000-38000 Remove the mysql templete tcp port: #semanage port -d -t mysqld_port_t -p tcp 3375 Set the data directory context: Default location for data directory - /var/lib/mysql/, the SELinux context used is mysqld_db_t. # semanage fcontext -a -t mysqld_db_t "/path/to/my/custom/datadir(/.*)?" # restorecon -Rv /path/to/my/custom/datadir Set the log directory context: # semanage fcontext -a -t mysqld_db_t "/path/to/my/custom/logdir(/.*)?" # restorecon -Rv /path/to/my/custom/logdir Set error log file context: The default location for RedHat RPMs is...