MySQL data are located under /var/lib/mysql by default, which could cause a problem to corrupt huge database.
Here the steps to change the data directory
Step1 :
To stop mysql deamon, simply drop the command line
/etc/init.d/mysql stop
Step 2:
to open the my.cnf file
#whereis my.cnf
#vim /etc/mysql/my.cnf (this is my server location…it may change…)
datadir=/home/mysql/ #was /var/lib/mysql/
Step 3:
Create a /home/mysql directory and give clearance to mysql
mkdir /home/mysql
chown -R mysql /home/mysql
chgrp -R mysql /home/mysql
Copy data and preserve permissions, etc.
cp -Rp /var/lib/mysql/* /home/mysql/
Step 4
Start the mysql service
/etc/init.d/mysql start
Regards
Siva