#StackBounty: #centos #mariadb Can't change the datadir for MariaDB mysql files

Bounty: 50

This is CentOS 8.1 and MariaDB 10.3 database server.

I have followed the directions I’ve seen in several places to relocate the datadir from the default of /var/lib/mysql to /home/mysql. /home is the RAID.

I’ve made the change in /etc/my.cnf putting this before the !include stuff, but it appears to be still pointing to /var/lib/mysql.

When I have done this, mysql complains and it won’t bring let my run the mysql command.

I have looked in /etc/my.cnf.d and see the default is still there in mariadb-server.cnf.

I see this message in the log and wasn’t sure if this was related or not?

Mar 11 11:58:44 myserver systemd[1]: Starting MariaDB 10.3 database server...

Mar 11 11:58:44 myserver mysql-prepare-db-dir[6349]: **Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.**

Mar 11 11:58:44 myserver mysql-prepare-db-dir[6349]: **If this is not the case, make sure the /var/lib/mysql is empty before running mysql-prepare-db-dir.**

I have tried running mysql-prepare-db-dir, but the same messages appear in the logs.

Get this bounty!!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.