Find the MySQL real data directory
Show variables like 'DataDir';+---------------+-----------------+|Variable_name|Value|+---------------+-----------------+|DataDir| /var/Lib/Mysql/ |+---------------+-----------------+
Steps:
Close Apache,tomcat
Turn off MySQL
Move /var/lib/mysql/ corresponding folder to the new location
Re-soft Connect /var/lib/mysql/ to new location
Start MySQL
Start Apache,tomcat
Brief steps:
Stop MySQL First:
/etc/init.d/mysqld stop
Moving data:
mv/var/lib/mysql/*/home/mysql/
To create a soft connection:
Ln-s/home/mysql//var/lib/mysql/
Start MySQL:
/etc/init.d/mysqld start
REF:
Database migration
Http://www.cnblogs.com/advocate/archive/2013/11/19/3431606.html
http://sofar.blog.51cto.com/353572/1598364/
Data File Path Migration
Http://blog.chinaunix.net/uid-77311-id-4530910.html
Http://www.jb51.net/article/47897.htm
Http://www.weste.net/2013/6-4/91953.html
Http://crx.xmspace.net/linux_mv_mysql_data.html
MySQL data (database) migration