Comments - Moving to the Default Directory

5 years, 7 months ago Faustin Lammler

Hi, you could use one of these tutorial for example: https://www.tecmint.com/change-default-mysql-mariadb-data-directory-in-linux/ https://www.digitalocean.com/community/tutorials/how-to-change-a-mariadb-data-directory-to-a-new-location-on-centos-7

But please first read this official documentation to be sure you understand the configuration system variables: https://mariadb.com/kb/en/library/server-system-variables/#datadir

Regards, Faustin

 
4 years ago Andy Ciaralli

Does not work on Centos 8 and mariadb 10.3.17 when moving /var/lib/mysql to /home/mysql (755 mysql.mysql). It is not a SELinux issue but a mysql variables issue.

Contents of /etc/mysql/my.cnf ******* [mysqld] datadir=/home/mysql socket=/home/mysql/mysql.sock

[client] port=3306 socket=/home/mysql/mysql.sock

!includedir /etc/my.cnf.d ******* The socket is still created in the old folder /var/lib/mysql even with the above settings.

Note the wrong paths in the output of systemctl status mariadb after restarting mariadb: mysql-prepare-db-dir[123950]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done. mysql-prepare-db-dir[123950]: If this is not the case, make sure the /var/lib/mysql is empty before running mysql-pre

What additonal headings are required in the /etc/my.cnf file or in other configuration files please?

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.