centos7.9 mysql 目录迁移注意事项
一、停止mysql服务
systemctl start mysqld
二、先复制原来的文件夹,确定正常启动后,再删除旧文件夹
cp -rf /var/lib/mysql /home/data/mysql
修改vi /etc/my.cnf
datadir=/home/data/mysql socket=/home/data/mysql/mysql.sock log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
1、权限问题
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
解决方法
修改selinux状态
getenforce (查看selinux状态)
setenforce 0 (临时关闭)
vi /etc/selinux/config
getenforce
修改目录权限
chmod -R a+rwx /home/data/mysql
参考链接
https://www.cnblogs.com/zs-chenkang/p/14387755.html