/etc/init.d/mysqld stop
cp -a -R /var/lib/mysql/* /home/mysql/ chown mysql:mysql -R /home/mysql/ chmod 777 /home/mysql/ -R
vi /etc/my.cnf [mysqld] datadir=/home/mysql socket=/home/mysql/mysql.sock
vi /etc/init.d/mysqld datadir "/home/mysql"
vi /usr/bin/mysqld_safe datadir "/home/mysql" DATADIR=/home/mysql
rm -fr /var/lib/mysql/mysql.sock ln -s /home/mysql/mysql.sock /var/lib/mysql/mysql.sock