How to change default directory of mariadb?

Solution Verified - Updated -

Issue

  • Unable to start service mariadb. Getting below errors after changing default data directory to /mnt/data/mysql
Database MariaDB is not initialized, but the directory /mnt/data/my>
Make sure the /mnt/data/mysql/ is empty before running mysql-prepar>
mariadb.service: Control process exited, code=exited status=1
systemd[1]: mariadb.service: Failed with result 'exit-code'.
systemd[1]: Failed to start MariaDB 10.3 database server.

Environment

  • Red Hat Enterprise Linux (RHEL) 7
  • mariadb

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content