Moving /var/lib/mysql

If you want to move the data which is stored in “/var” to another partition.

To move that path to another partition, run the following:

cd /home
mkdir mysql
chown mysql:mysql mysql
cd mysql
/sbin/service mysqld stop
cp -Rp /var/lib/mysql/* .
cd /var/lib
mv mysql mysql_old
ln -s /home/mysql ./mysql
/sbin/service mysqld start

Once satisfied that mysqld is running, remove the old data:

rm -rf mysql_old

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.