Marc's answer is correct. However, I would choose to move all the table subdirectory to your new disk (the following example would work in linux)
Since you have mounted the new disk in /var/newdisk
, you would have to
create a subdirectory for the mysql data (pq imagine that the new disk will host other things)
stop the mysql service
copy the tables to the new location
that would be:
mkdir /var/newdisk/mysql_new
sudo service mysql stop
rsync -avzr /var/lib/mysql/ /var/newdisk/mysql_new/
then:
modify the mysql configuration file (usually mysqld.cnf
) and just in case, by copying it to mysqld.cnf.bak
in case something goes wrong.
change the datadir
parameter in that file
setting or replacing the existing parameter:
datadir=/var/newdisk/mysql_new/
restart the mysql service
(with sudo)
sudo service mysql start
Your original directory is still intact so you can step back by resetting the original configuration.