Change the mariadb default data file path /var/lib/mysql to /data/mysql
systemctl stop mariadb
mkdir -p /data
chown -R mysql:mysql /data/
cp -a /var/lib/mysql /data/
vi /etc/my.cnf.d/server.cnf
Modify the datadir path:
datadir=/data/mysql
#Start the database
systemctl start mariadb
--This article is transferred from https://www.cnblogs.com/gelandesprung/p/12111223.html