MariaDB10.5 datadir change gives error on Redhat Ootpa 8.8

39 Views Asked by At

I have done the data directory for MariaDB on the Ubuntu 22.04 server and it was successful without an issue. But when I am trying the same steps on the Redhat Ootpa 8.8 I face an issue. Please help me with what could be the reason. Please find the error log. Even I tried with an empty directory but still face issues. Please help me with the same.

● mariadb.service - MariaDB 10.5 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2023-10-03 19:00:28 IST; 6s ago
     Docs: man:mysqld(8)
           https://mariadb.com/kb/en/library/systemd/
  Process: 952547 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 952530 ExecStart=/usr/libexec/mysqld --basedir=/usr $MYSQLD_OPTS $_WSREP_NEW_CLUSTER (code=exited, status=0/SUCCESS)
  Process: 953295 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mariadb.service (code=exited, status=1/FAILURE)
  Process: 953270 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Main PID: 952530 (code=exited, status=0/SUCCESS)

Oct 03 19:00:28 ltap00234 systemd[1]: Starting MariaDB 10.5 database server...
Oct 03 19:00:28 ltap00234 mysql-prepare-db-dir[953295]: Database MariaDB is not initialized, but the directory /home/ltap00234/mariadb/data is not empty, so initialization cannot be done.
Oct 03 19:00:28 ltap00234 mysql-prepare-db-dir[953295]: Make sure the /home/ltap00234/mariadb/data is empty before running mysql-prepare-db-dir.
Oct 03 19:00:28 ltap00234 systemd[1]: mariadb.service: Control process exited, code=exited status=1
Oct 03 19:00:28 ltap00234 systemd[1]: mariadb.service: Failed with result 'exit-code'.
Oct 03 19:00:28 ltap00234 systemd[1]: Failed to start MariaDB 10.5 database server.

Thanks in advance

1

There are 1 best solutions below

0
dinu0101 On

I have followed the instruction provided by the https://www.tecmint.com/change-default-mysql-mariadb-data-directory-in-linux/

issue with the selinux(Linux security). below specified commands save my life.

# semanage fcontext -a -t mysqld_db_t "/mnt/mysql-data(/.*)?"
# restorecon -R /mnt/mysql-data