Comments - mariadb server won't start after moving the data directory
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.
When we start mariadb service after changing the default mariadb data directory then there is an error in starting services due to change in SE linux policy. Therefore, below changes needs to be done in SE linux policy
1) semanage fcontext -a -t mysqld_db_t "/mnt/volume-nyc1-01/mysql(/.*)?" 2) restorecon -Rv /mnt/volume-nyc1-01/mysql 3) Also add below section in mariadb configuration “/etc/my.cnf file” [client] socket=/mnt/volume-nyc1-01/mysql/mysql.sock 4) sudo systemctl start mariadb 5) mysql -u root -p 6) select @@datadir; 7) In output new data directory "/mnt/volume-nyc1-01/mysql/" should be visible