Move data mysql mariadb sang thư mục khác
service mariadb stop
rsync -av /var/lib/mysql /home/innocom
mv /var/lib/mysql /var/lib/mysql.bak
vi /etc/my.cnf
[mysqld]
. . .
datadir=/home/innocom/mysql
socket=/home/innocom/mysql/mysql.sock
. . .
After updating the existing lines, we’ll need to add configuration for the mysql
client. Insert the following settings at the bottom of the file so won’t split up directives in the [mysqld]
block and above the include
line:
[client]
port=3306
socket=/home/innocom/mysql/mysql.sock
!includedir /etc/my.cnf.d
------
chcon -Rt mysqld_db_t /home/innocom/mysql
chcon -Ru system_u /home/innocom/mysql
chown -R mysql:mysql /home/innocom/mysql
systemctl start mariadb
HiepNH -
chcon: can’t apply partial context to unlabeled file
chcon -Rh system_u:object_r:mysqld_db_t:s0 /data/innocom/mysql
Minh Vương -
kiểm tra phpinfo xem mysql đã gọi sang folder mới chưa, nếu chưa sửa trong file php.ini
mysqli.default_socket = /home/innocom/mysql/mysql.sock