This quick HOWTO covers moving Mysql's database storage to a different location.
First we need to stop mysql if it is running. Type the following:
> service mysqld stop
Next copy the data to the new location and fix the ownership.
> cp -R /var/lib/mysql /home/
> mv /home/mysql /home/databases
> chown -R mysql:mysql /home/databases
Save the old databases directory.
> mv /var/lib/mysql/ /var/lib/mysql_old
Now we need to take care of the needs of some scripts that may not know the data has been moved.
> ln -s /home/databases/ /var/lib/mysql
> chown mysql:mysql /var/lib/mysql
Finally we can restart Mysql. Type the follwoing:
> service mysqld start
Enjoy