Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Closed Thread
  Search this Thread
Old 09-04-2015, 01:56 PM   #1
LQ Newbie
Registered: Sep 2015
Posts: 3

Rep: Reputation: Disabled
Cool Failed Job. After restorecon -R -v /opt/mysql?

Ok these are the exact steps I took

1. As root run ls- lZ /var/lib/mysql to view SElinux context of the data directory..
2. Then log in to... mysqlshow -uroot -p with the password
3. Shutdown mysqld daemon... service mysqld stop
4. mkdir /opt/mysql
5. Copy files from old location to new... cp -R /var/lib/mysql/* /opt/mysql
6. Change ownership chown -R mysql:mysql/opt/mysql
7. Check results ls -lZ
Compare if results matched step 1
8. Open main MySQL config file. gedit /etc/my.cnf and modify the datadir.
Needs to look like this below...
9. Start mysqld.... service mysqld start as the root user...
Job failed.
Check the last lines of the error messafes by typing tail -f /var/log/messages
Job Failed.
10. The reason for denial is that the /opt/mysql is not labeled correctly for MySQL files.
Run semanage fcontext -a -t mysqld_db_t "/opt/mysql(/.*)?"
This maps the written to /etc/selinus/targeted/contexts/files/file_contexts.local file
Review results run...
grep -i mysql /etc/selinus/targeted/contexts/files/file_contexts.local
Restorecon command
restorecon -R -v /opt/mysql
11. /opt/mysql has now been labeled with correct context for MySQL
I receive job failed.
12. Make sure service is running ps -aef | grep mysqld
13. Confirm: ls -lZ /opt

So I really dont know why its not restarting?
Every step I listed is a must.

Please help me thanks a bunch!!!
Old 09-05-2015, 04:15 AM   #2
Registered: May 2001
Posts: 29,360
Blog Entries: 55

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
After you receive the last job failed, what does 'grep mysql /var/log/audit/audit.log|audit2allow; ' return?
*BTW no need for 'ps -aef | grep mysqld;' when you can do 'pgrep -lf mysqld;' (or even 'ps --no-headers -o pid,cmd,context -C mysqld;').
Old 09-06-2015, 09:14 AM   #3
LQ 5k Club
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,573
Blog Entries: 14

Rep: Reputation: Disabled
similar, if not exact same thread at

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] MySQL - start: Job failed to start czezz Ubuntu 1 04-26-2014 05:24 AM
MySQL performance opt for a 5000 connection web site? explorer1979 Linux - Server 5 01-31-2012 08:26 PM
restorecon command not found zhaidoudou123 Linux - Software 6 01-14-2012 07:51 AM
Regarding # /opt/CTEact/bin/act & /opt/SUNWexplo/bin/explorer not available for x86 rajaniyer123 Solaris / OpenSolaris 6 04-24-2008 10:09 AM
how do i make restorecon work on fc5 kobbee Linux - Kernel 6 09-14-2006 01:20 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:46 PM.

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