Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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...
SAVE and CLOSE FILE
9. Start mysqld.... service mysqld start as the root user...
Check the last lines of the error messafes by typing tail -f /var/log/messages
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.
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;').