LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 12-11-2015, 12:29 PM   #1
BigMike44
LQ Newbie
 
Registered: Dec 2015
Posts: 3

Rep: Reputation: Disabled
SELinux Blocking MySQL Data Dir Moved - Standard Solution not working


I am reinstalling linux Centos 6 to have the OS on an SSD. In the process Ihave moved my MySQL data directory onto a HDD, made the necessary modifications to my.cnf and now SELinux is preventing mySQL from starting.

I have discovered a workaround for this so I'm asking this forum for a proper fix.

The typical fix for this, to set a new SELinux context for the new data directory location isn't working. I believe it has something to do with the full path of the data directory not satisfying SELinux because I can get it to work using the command below:

As instructed:
semanage fcontext -a -t mysqld_db_t "/mnt/HDD0/DBData/mysql(/.*)?" -> MySQL can't start
Temporary work around:
semanage fcontext -a -t mysqld_db_t "/mnt(/.*)?" -> MySQL can start.

It is a requirement for me to put the data directory in /mnt/HDD0/DBData/.

I'd like to do this properly. I am currently reading the Red Hat SELinux manual, and I am finding it daunting.

Notes:
I am using Centos 6.4, MySQL 5.6, and.

I have followed the instructions on both of the following.
https://blogs.oracle.com/jsmyth/entry/selinux_and_mysql
https://access.redhat.com/documentat..._Examples.html
 
Old 12-11-2015, 12:56 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by BigMike44 View Post
As instructed:
semanage fcontext -a -t mysqld_db_t "/mnt/HDD0/DBData/mysql(/.*)?" -> MySQL can't start
Temporary work around:
semanage fcontext -a -t mysqld_db_t "/mnt(/.*)?" -> MySQL can start.
How about
Code:
semanage fcontext -a -t mysqld_db_t "/mnt/HDD0/DBData(/.*)?"
?
 
Old 12-11-2015, 01:54 PM   #3
BigMike44
LQ Newbie
 
Registered: Dec 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
Working on it. Right now trying to figure out how to remove the context I added for /mnt.
 
Old 12-11-2015, 02:19 PM   #4
BigMike44
LQ Newbie
 
Registered: Dec 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
I can't test out your suggestion because I've lost the configuration of the system that produces the problem.

I issued the following command to delete the context:

semanage fcontext -d "/mnt(/.*)?"

and after rebooting now MySQL starts without any problem!

I'll check again today for any feedback, but at this point, I'm not willing to install the OS again to solve this problem.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is SELinux blocking my FTP uploads? fakefake Linux - Server 26 10-13-2017 08:16 PM
Is sed a solution to this problem for loading data back into mysql db? newbie14 Linux - Newbie 14 12-23-2011 07:09 AM
Help, Selinux blocking append to named.log. mysteron Linux - Security 2 07-15-2008 07:01 AM
MYSQL data dir android6011 Linux - Software 22 10-10-2005 09:32 PM
Standard Apache install dir p41elvis Linux - Software 2 04-26-2005 03:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 01:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration