Move MySQL Databases

Hi all,

I want to move all the MySQL databases to a different location on my cpanel based server, is this the correct procedure?


# stop services
/etc/rc.d/init.d/chkservd stop
/etc/rc.d/init.d/mysql stop


# double check mysql has stopped
ps aux|grep mysql

# copy databases to a new location
cp -r /var/lib/mysql /newpath/mysql


alter /etc/my.cnf

change
datadir=/var/lib/mysql
to
datadir=/newpath/mysql


# restart services
/etc/rc.d/init.d/mysql start
/etc/rc.d/init.d/chkservd start



Do I need to do anything else or modify any other files?



Thanks
Pete

 

 

 

 

Top