LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-18-2009, 11:17 PM   #1
jdnow09
Member
 
Registered: Jun 2009
Posts: 42

Rep: Reputation: 16
Mysqld won't start with Selinux enforcing turned on


Guys,


I changed the default data location for mysql. Modified my.cnf on /etc.

Give mysql access to the new directory and moved the databases over.


Everything works fine. But when I turn selinux to 'enforcing', mysqld won't start.

How do I workaround this and be able to still have selinux be in 'enforcing' mode


Thanks in advance.

John
 
Old 06-19-2009, 12:05 AM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
The context for the directory has to be correct, so for example
Quote:
]# ls -dZ /var/lib/mysql
drwxr-xr-x mysql mysql system_u:object_r:mysqld_db_t /var/lib/mysql
so "chcon system_u:object_r:mysqld_db_t /path/to/directory" should help
 
Old 06-19-2009, 02:13 PM   #3
jdnow09
Member
 
Registered: Jun 2009
Posts: 42

Original Poster
Rep: Reputation: 16
Billymayday,

I finally got around to try it but I don't have any luck. Getting "Timeout error occurred trying to start MySQL Daemon."


selinux is off

[root@centos53a ~]# ls -dZ /var/lib/mysql
drwxr-xr-x mysql mysql system_ubject_r:mysqld_db_t:s0 /var/lib/mysql


[root@centos53a ~]# ls -dZ /u03
drwxr-xr-x mysql mysql /u03


*** I did the command you suggested below, /u03 is the new location of mysql in my.cnf file ***

[root@centos53a ~]# chcon system_ubject_r:mysqld_db_t:s0 /u03


[root@centos53a ~]# ls -dZ /u03
drwxr-xr-x mysql mysql system_ubject_r:mysqld_db_t:s0 /u03

selinux is on

reboot

*** after reboot, it shows the following***

[root@centos53a /]# ls -dZ /var/lib/mysql
drwxr-xr-x mysql mysql system_ubject_r:mysqld_db_t /var/lib/mysql



[root@centos53a /]# ls -dZ /u03
drwxr-xr-x mysql mysql system_ubject_r:mysqld_db_t /u03


-John

Last edited by jdnow09; 06-24-2009 at 02:02 AM.
 
Old 06-24-2009, 01:37 PM   #4
jdnow09
Member
 
Registered: Jun 2009
Posts: 42

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by jdnow09 View Post
Billymayday,

I finally got around to try it but I don't have any luck. Getting "Timeout error occurred trying to start MySQL Daemon."


selinux is off

[root@centos53a ~]# ls -dZ /var/lib/mysql
drwxr-xr-x mysql mysql system_ubject_r:mysqld_db_t:s0 /var/lib/mysql


[root@centos53a ~]# ls -dZ /u03
drwxr-xr-x mysql mysql /u03


*** I did the command you suggested below, /u03 is the new location of mysql in my.cnf file ***

[root@centos53a ~]# chcon system_ubject_r:mysqld_db_t:s0 /u03


[root@centos53a ~]# ls -dZ /u03
drwxr-xr-x mysql mysql system_ubject_r:mysqld_db_t:s0 /u03

selinux is on

reboot

*** after reboot, it shows the following***

[root@centos53a /]# ls -dZ /var/lib/mysql
drwxr-xr-x mysql mysql system_ubject_r:mysqld_db_t /var/lib/mysql



[root@centos53a /]# ls -dZ /u03
drwxr-xr-x mysql mysql system_ubject_r:mysqld_db_t /u03


-John

Finally got it to work with the following:



chcon -Rv --type=system_ubject_r:mysqld_db_t my_new_dir

I just needed to give both the files and directory access.

Thanks again.


John
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is Clarkconnect compiled with GRSecurity or SeLinux turned on? enyawix Linux - Security 4 06-22-2009 09:17 PM
create linux group & user when SELinux enforcing kirukan Linux - Security 5 05-05-2009 02:44 PM
mysqld cannot start raixun Linux - Server 4 09-16-2008 06:54 AM
How to execute a Perl script in ~/.procmailrc with SELinux set to Enforcing? thomasz Linux - Security 1 03-14-2008 05:25 AM
Apache/PHP problems with Selinux enforcing.... maxie_fc3 Fedora 0 01-11-2005 07:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:11 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