Please note that this workaround is intended for the Server Administrator. cPanel Support cannot perform these steps on your behalf and cannot assist with any issues encountered in this process. Do ensure that you have working MySQL backups prior to attempting this workaround. Please reference our document on creating MySQL backups if needed.
You may receive a warning when trying to upgrade MariaDB after MariaDB 10.1:
Error: An upgrade on your system is not possible at this time! Please correct the following errors before you attempt to upgrade:
As of MariaDB 10.1.16, the data directory cannot reside in /home, /usr, /etc, /boot, or /root directories on systemd equipped systems.
You must move your MariaDB data directory outside of these directories before continuing with this upgrade.
The following instructions are not supported, though; if you are in a situation where your MariaDB data directory is outside of /var/lib/mysql, and you cannot upgrade the service, then you can follow this information to get around the issue.
Please follow these commands in sequence to create the bind-mount in question:
- Add a line like the following to the bottom of /etc/fstab:
/home/var_mysql/mysql /var/lib/mysql none bind
- Disable service monitoring, so MySQL is not restarted during the process
whmapi1 configureservice service=mysql enabled=0 monitored=0
- Stop the MySQL service to avoid issues when making changes to the mount.
- Remove the existing symbolic link
\rm -vi /var/lib/mysql
- Create the directory for the bind mount.
mkdir /var/lib/mysql && chown mysql:mysql /var/lib/mysql && chmod 751 /var/lib/mysql
- Mount the bind mount defined in the /etc/fstab earlier
- Remove datadir configuration option in /etc/my.cnf if it's set.
- Enable service monitoring
whmapi1 configureservice service=mysql enabled=1 monitored=1
- Restart MySQL