Background Info:
I let the CentOS 7 installer to partition automatically.
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 50G 43G 7.9G 85% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 9.3M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/sda1 492M 123M 369M 25% /boot
/dev/mapper/centos-home 476G 54G 422G 12% /home
tmpfs 6.3G 0 6.3G 0% /run/user/1000
tmpfs 6.3G 0 6.3G 0% /run/user/0
But I didn't expect not most of the disk space goes to the / root directory, and MariaDB is now 35GB in /var/lib/mysql running out of space soon.
So I changed the datadir, by commands below, but then failed to start
systemctl stop mariadb
cp -fR /var/lib/mysql /home/
chown -R mysql:mysql /home/mysql
vi /etc/my.cnf.d/server.cnf and added the following line
[mysqld]
datadir=/home/mysql
systemctl start mariadb
but it failed and compliant about "Can't create test file"
Jul 06 22:32:26 ging2 systemd[1]: Starting MariaDB database server...
Jul 06 22:32:26 ging2 mysqld[9450]: 2017-07-06 22:32:26 140114825693312 [Note] options --log-slow-admin-statements, --log-queries-not-us...s not set
Jul 06 22:32:26 ging2 mysqld[9450]: 2017-07-06 22:32:26 140114825693312 [Note] /usr/sbin/mysqld (mysqld 10.2.5-MariaDB) starting as process 9450 ...
Jul 06 22:32:26 ging2 mysqld[9450]: 2017-07-06 22:32:26 140114825693312 [Warning] Can't create test file /home/mysql/ging2.lower-test
Jul 06 22:32:26 ging2 mysqld[9450]: [87B blob data]
Jul 06 22:32:26 ging2 mysqld[9450]: 2017-07-06 22:32:26 140114825693312 [ERROR] Aborting
I have no idea why it doesn't work and I think the permissions and ownership are the same as the old datadir.
I think some of you guys know why. So could anyone help please?
Thanks!!