Linux, MySQL

MySQL Step-by-Step Installations

If you are on Fedora or Red Hat Box

$ setenforce 0 #disbles selinux temporarily

$ yum install mysql

If you have a rpm then

$ rpm -i <strong><strong><code>/mysqlSRC_RPM_Folder/MySQL*

You can download rpm’s from

$ restorecon -R /var/lib/mysql/ #restore selinux labels
$ setenforce 1 #enable selinux again

Now, I successfully installed MySQL. Now I wanted to change the location of where the actual data would be stored, I tried configuring the my.cnf file and using symlinks. I found using the symlinks to be easier and more compatible.

My data directory is /home/mysql.

The following is what I did to change the data directory after using RPM to install.

1. stop mysql server
2. mkdir /home/mysql
3. mv /var/lib/mysql/* /home/mysql/
4. rmdir /var/lib/mysql
5. ln -s /home/mysql /var/lib/mysql

Instead of using symlinks,we can just modify the my.cnf file (/etc/my.cnf)  by including “datadir = /home/mysql”

6. chown -R mysql:mysql /home/mysql
7. start mysql server again


About Jit

Having expertise in dynamic and interactive web applications design and development looking for a challenging position in LAMP (Linux, Apache, MySQL and PHP) environment and MySQL DBA.In depth Knowledge and experience of client/server technologies, internet/intranet based programming techniques, MVC Architecture server management and object-oriented approaches, user centered design approach.Expertise in Provides Business Solutions, Project Documentations, Architecture, Design, Functional Documentation
View all posts by Jit →

Leave a Reply

Your email address will not be published. Required fields are marked *