红联Linux门户
Linux帮助

记一次mysql启动失败分析和处理-原因:SElinux

发布时间:2017-06-11 00:31:08来源:linux网站作者:一路向北的兔斯基
在51、52、54三台主机上搭建Galera集群,在54上安装mysql并能成功启动,但在51、52上始终无法启动,能看到的日志也非常少。
localhost systemd: Starting LSB: start and stop MySQL...
localhost mysql: Starting MySQL.170228 16:45:19 mysqld_safe Logging to '/var/lib/mysql/controller2.err'.
localhost mysql: 170228 16:45:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
localhost mysql: /usr/bin/mysqld_safe_helper: Can't create/write to file '#001' (Errcode: -1769717024)
localhost mysql: [FAILED]
localhost systemd: mysql.service: control process exited, code=exited status=1
localhost systemd: Failed to start LSB: start and stop MySQL.
localhost systemd: Unit mysql.service entered failed state.
localhost systemd: mysql.service failed.
 
但能分析的内容太少,通过journalctl -xe也看到如下日志:
compute2 useradd[16108]: failed adding user 'mysql', exit code: 9
 
分析感觉与权限有关系,查看/etc/passwd中mysql用户是存在的,并且/var/lib/mysql目前也存在并且权限也是mysql。
但51和52的mysql的始终启动不了,对于这种没有太多异常日志的问题处理,感觉真的无力下手。
 
后面在网上浏览帖子,发现有提到过selinux,就试着用getenforce查看了三台主机的状态,发现54关闭,51和52两台是开着的。
 
关闭selinux 后,通过如下命令:
yum install MariaDB-Galera-server MariaDB-client galera
安装后mysql启动正常了。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31409.html