修改了 /etc/my.cnf 将datadir改了,datadir=/data/mysql
无法启动,报错:
Mar 14 13:59:29 localhost.localdomain mariadb-prepare-db-dir[10433]: Cannot change ownership of the database directories to the 'mysql'
Mar 14 13:59:29 localhost.localdomain mariadb-prepare-db-dir[10433]: user. Check that you have the necessary permissions and try again.
Mar 14 13:59:29 localhost.localdomain mariadb-prepare-db-dir[10433]: Initialization of MariaDB database failed.
Mar 14 13:59:29 localhost.localdomain mariadb-prepare-db-dir[10433]: Perhaps @sysconfdir@/my.cnf is misconfigured or there is some problem with permissions of /data/mysql.
是由于/data/mysql的文件拥有者导致的,修改所有者重启:
chown -R mysql:mysql /data/mysql