报错和解决
mysql启动报错 Can’t create test file xx
[Warning] Can’t create test file xx
[ERROR] Aborting
启动失败
netstat -ntlp
systemctl start mysqld.service
systemctl restart mysqld.service
systemctl status mysqld.service
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
journalctl -xe
cd /var/lib/mysql
[root@pdjjw-int-zhjtzhyyy-appserver-07 mysql]# whereis my.cnf
my: /etc/my.cnf
cat /etc/my.cnf
#datadir=/var/lib/mysql
datadir=/home/DZZP/mysqlData
port=3006
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
问题定位
tail -n500 /var/log/mysqld.log|grep -E 'Warning|ERROR'
2023-03-16T05:15:42.758175Z 0 [Warning] Can't create test file /home/DZZP/mysqlData/pdjjw-int-zhjtzhyyy-appserver-07.lower-test
2023-03-16T05:15:42.758677Z 0 [ERROR] Aborting
2023-03-16T05:15:43.965873Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
解决 关闭 selinux
- SELinux惹的祸 https://www.cnblogs.com/jsersudo/p/12985757.html
- 关闭后,重启服务即可。
通俗的讲就是linux服务器的安全策略
临时关闭:setenforce 0 (0关 |1 开)
永久关闭需要修改配置文件,重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
-
mysql启动失败排查
-
https://blog.csdn.net/weixin_38052017/article/details/90228989
先查看当前配置信息.
#getenforce
Enforcing
就表明SELinux已经启用.只需要关闭即可。
关闭方法:
#setenforce 0 (0|1 开|关)
或者
setsebool ftpd_disable_trans 1