There are a lot of answers on Google about moving a MySQL datadir, but the gist of it on linux is:
It can be advantageous to move the directory on the supervisor which contains the SQL databases from the root volume or C: drive to a filesystem on a separate physical disk that is dedicated to the SQL databases. This should be a separate physical disk, not just another partition on the same disk as other partitions, otherwise you'll get almost no benefit.
Linux
- Be logged into the Supervisor as the root user
- Stop the Supervisor service:
/etc/init.d/supervisor stop
- Stop the mysql server:
/etc/init.d/mysqld stop
- Copy the current datadir over to the new location ensuring that you preserve ownership and permissions:
cp -rP /var/lib/mysql /newpath/mysql
- Rename the current datadir so that it won't be found by mistake, but leave it in place so you have a fallback plan:
mv /varl/lib/mysql /var/lib/mysql.MOVED
- Edit the /etc/my.cnf, copy the
datadir
line, comment out the original as a backup (part 2 of the fallback plan), and edit the uncommented line to point to the new location - Start the mysql server:
/etc/init.d/mysqld start
- Check that the new datadir is the one being used:
mysql -u root -e "SHOW variables like 'datadir'"
...
/etc/init.d/supervisor start
Windows
- stop the qubesupervisor service
- stop the pfxmysql service
- move the C:\Program Files\pfx\qube\mysql\data directory to the new directory, e.g., D:\qube\data
- edit C:\Program Files\pfq\qube\mysql\my.cnf, change the datadir value to point to D:\qube\data
- start the pfxmysql service
- test that the mysql server sees the databases in their new location by running:
mysql -u root -e "SHOW DATABASES"
It should return a list of databases which include some with the word "qube" in the name. - start the qubesupervisor service