Move MySQL to Home Partition

From Tech Wiki
Revision as of 10:53, 28 April 2016 by Adam.birds (talk | contribs) (Created page with "To move MySQL from '''/var/lib/mysql''' to '''/home/mysql''' please do the following: Use the following command to stop MySQL: <pre> service mysqld stop </pre> Use the foll...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

To move MySQL from /var/lib/mysql to /home/mysql please do the following:

Use the following command to stop MySQL:

service mysqld stop

Use the following command to edit the MySQL Config File:

vi /etc/my.cnf

Then change the following:

datadir=/var/lib/mysql

To the following:

datadir=/home/mysql

Then use the following command to make the /home/mysql directory:

mkdir /home/mysql

Then set the ownership of this directory using the following command:

chown mysql:mysql /home/mysql

Then move the MySQL files using the following command:

mv /var/lib/mysql/* /home/mysql/

Use the following command to restart MySQL:

service mysqld restart

Then perform a mysqlcheck using the following command:

mysqlcheck –Ar

Wait for this to finish and it should be fine.

If this is done on a backup server perform the following commands:

service bacula-sd restart
service bacula-fd restart
service bacula-dir restart