Moving Mysql Databases to a different drive.
Open the Terminal
Root -i This makes you the root user.
/etc/inin.d/mysql stop This stops MYSQL
mv -rp /var/lib/mysql /Path to where you want the database to reside/mysql
This command moves your database.
Now we need to edit some files so that MYSQL can find the database.
We will be using the VI editor so if you don't know how to use it, please do a google search before you begin.
vi /etc/apparmor.d/usr.sbin.mysqld
Go to the bottom of this file and add these two lines.
/the new patth to your database/ r,
/the new path to your database/** rwk,
Save the file and quit the VI editor
/etc/init.d/apparmor restart
vi /etc/mysql/my.cnf
Look for the line that starts with datadir
change this line to
datadir = the path to the new location of your database.
Save the file and quit the VI editor
/etc/init.d/mysql restart
exit
If you have made it to the end with no errors your databases will now be accesable in there new location.
Bookmarks