Change MariaDB tmp folder?


Jul 25, 2015
cPanel Access Level
Root Administrator

I try to change tmp folder of mariadb because I found out that files .MAD are are constantly being created inside tmp folder and despite the fact that I increased the tmp folder from the beginning of the installation of cpanel to 15GB are filling the space with results operational problems of cpanel.

The tutorials I found on the internet are to create in /home directory a folder for example called mysqltmp to chown mysql:mysql and chmod 1777. Then add parameter to my.cnf like tmpdir=/home/mysqltmp. But after restart mariadb is not starting and exiting with error.

Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.
Am I doing something wrong?



Staff member
Apr 11, 2011
Hello @geokat,

Using a data directory within /home, /usr, /etc, /boot, or /root is unsupported because MariaDB uses a default systemd unit configuration that enables the "ProtectSystem" and "ProtectHome" features.

The best approach to solving this problem is attempting to determine what's leading to the excessive temporary space utilized by MariaDB. There's an answer on the following StackOverflow discussion noting one method of doing this:

As far as workarounds related to the size of the MySQL temporary directory itself, while unsupported, setting up a bind mount to point /var/lib/mysqltmp/ to the desired /home/mysqltmp directory should allow it to work until you've had a chance to increase the size of your /var/ partition or migrate to a server with a new partition scheme.

Thank you.