LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Job Failed Error after trying to use the "service mysqld start" command? (https://www.linuxquestions.org/questions/linux-newbie-8/job-failed-error-after-trying-to-use-the-service-mysqld-start-command-4175552554/)

j3llimari3 09-03-2015 04:43 PM

Job Failed Error after trying to use the "service mysqld start" command?
 
Hello,

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!

-j3llimari3

Habitual 09-03-2015 05:26 PM

Are the myql data files in /opt/mysql on fedora?
Where were they now?
Where are they going to go?
You did a
Code:

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:
Code:

datadir                = /var/lib/mysql
Change datadir there and then restart mysql-server.

Lots of clues. I took notes. :)

Good luck. ;)

j3llimari3 09-04-2015 10:28 AM

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.
[mysqld]
datadir=/opt/mysql
SAVE and CLOSE FILE
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


All times are GMT -5. The time now is 02:20 AM.