Download your favorite Linux distribution at LQ ISO.
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!


  Search this Thread
Old 09-03-2015, 05:43 PM   #1
LQ Newbie
Registered: Sep 2015
Posts: 3

Rep: Reputation: Disabled
Talking Job Failed Error after trying to use the "service mysqld start" command?


Im really new to linux and I've been complete stuck on this part of a lab assignment. I've emailed instructor and a few classmates but no one has gotten back to me.

The purpose of this exercise is to Change the location of MySQL Data Directory using Fedora Linux.

So what I need to do is use the restorecon command:

[root@localhost op]#restorecon -R -v /opt/mysql

then I need to restart the mysql server using:

[root@localhost op]#service mysql start

After I run the "service mysql start" command and the terminal displays:

Redirecting to /bin/systemctl start mysqld.service
Job failed. See system journal and 'systemctl status' for details.

So I have no idea how to get the service to start again or what this means. Can someone please dumb this down for me thanks!

Old 09-03-2015, 06:26 PM   #2
LQ 5k Club
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,573
Blog Entries: 15

Rep: Reputation: Disabled
Are the myql data files in /opt/mysql on fedora?
Where were they now?
Where are they going to go?
You did a
restorecon -R -v /opt/mysql
but didn't mention shutting down msyql-server, nor the file copy, or move from the former to the latter?
Did you also change my.cnf? eg:
datadir		= /var/lib/mysql
Change datadir there and then restart mysql-server.

Lots of clues. I took notes.

Good luck.

Last edited by Habitual; 09-03-2015 at 06:30 PM.
1 members found this post helpful.
Old 09-04-2015, 11:28 AM   #3
LQ Newbie
Registered: Sep 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled

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.
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?

Please help


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
unable to START MySQL server at BOOT "systemctl enable mysqld.service" does not work cyberdome Linux - Newbie 2 03-11-2014 03:35 AM
"nmcli con" failed "Can't obtain connections: settings service is not running." parcox Slackware 2 08-14-2012 05:26 PM
can not "service mysqld start" dfw123 Linux - Newbie 7 05-03-2007 01:29 AM
service named error "rndc: conenct failed: connection refused" Reu Linux - General 1 07-12-2004 02:34 PM > Forums > Linux Forums > Linux - Newbie

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