In this article we will explain how to change a default MySQL/MariaDB database data directory (/var/lib/mysql) to a different path on a CentOS/RHEL and Ubuntu.