Debian: MySQL/MariaDB will install data to /var/lib/mysql from /home/mysql (SCRIPTS)

Version 1.54

Bugfix
Finished

Existing systems will not be affected. This only applies to new installs. For a long time, DirectAdmin has always used /home/mysql as the data path for MySQL/MariaDB. The binaries and versions are installed to /usr/local/mariadb-10.2.12-linux-glibc_214-x86_64, for example, where this path is a link to: /usr/local/mariadb-10.2.12-linux-glibc_214-x86_64 -> mysql Then the data path is also a link: /usr/local/mysql/data -> /home/mysql which of course has now been changed to: /usr/local/mysql/data -> /var/lib/mysql for new installs. For backwards compatibility (in case anyone is using the absolute /home/mysql path), a link has been created: /home/mysql -> /var/lib/mysql This does mean that you may need to adjust your partition sizes if you're already maxing out your / or /var partitions, as the MySQL data will be moved from /home to /var. ======== REASON The reason for this is that newer MariaDB versions need read access all the way down the path (not too sure why, but they do), eg: openat(-1, "/home", O_RDONLY|O_NOFOLLOW|O_PATH) = -1 EACCES (Permission denied) openat(-1, "/home", O_RDONLY|O_NOFOLLOW|O_PATH) = -1 EACCES (Permission denied) write(2, "180910 16:04:47 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/host.MYI' is read only\n", 113180910 16:04:47 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/host.MYI' is read only and we cannot change /home to 755 for security reasons. /home should be 711 so it's contents cannot be read by Users. ========= SCRIPT The debian script: /usr/local/directadmin/scripts/mysql.sh has very minor changes to swap /home/mysql to /var/lib/mysql, and add the /home/mysql -> /var/lib/mysql link. The paths in the my.cnf should not be affected, since they use the link paths, eg: /usr/local/mysql/data/mysql.sock which contains 2 links (mysql and data), so it can be left alone.

Interested to try DirectAdmin? Get a 30-day Free Trial!