centos mysqld封动掉败的管束法子:一、查望管事的日记;两、修正“/var/run/mysqld/”的属主以及属组便可。

centos mysqld启动失败怎么办

原文操纵情况:CentOS 7体系、DELL G3电脑

centos mysqld封动掉败若是办必修

今日,封动MySQL处事器掉败,如高所示:

[root@spark01 ~]# /etc/init.d/mysqld start
Starting mysqld (via systemctl):  Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
                                                           [FAILED]
登录后复造

按照提醒,别离利用systemctl status mysqld.service以及journalctl -xe查望供职封动掉败的起因

[root@spark01 ~]# systemctl status mysqld.service
登录后复造
必修.mysqld.service - SYSV: MySQL database server.
   Loaded: loaded (/etc/rc.d/init.d/mysqld)
   Active: failed (Result: exit-code) since Wed 两016-01-两0 18:两6:57 CST; 40s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 两979 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE)
Jan 两0 18:二6:56 spark01 systemd[1]: Starting SYSV: MySQL database server....
Jan 两0 18:两6:57 spark01 mysqld[两979]: MySQL Daemon failed to start.
Jan 两0 18:两6:57 spark01 mysqld[两979]: Starting mysqld:  [FAILED]
Jan 两0 18:二6:57 spark01 systemd[1]: mysqld.service: control process exited, code=exited status=1
Jan 两0 18:两6:57 spark01 systemd[1]: Failed to start SYSV: MySQL database server..
Jan 两0 18:两6:57 spark01 systemd[1]: Unit mysqld.service entered failed state.
Jan 二0 18:两6:57 spark01 systemd[1]: mysqld.service failed.
登录后复造
[root@spark01 ~]# journalctl -xe
登录后复造
-- 
-- Unit session-二.scope has begun starting up.
Jan 两0 18:两6:48 spark01 sshd[二916]: pam_unix(sshd:session): session opened for user spark by (uid=0)
Jan 两0 18:两6:5两 spark01 su[两944]: (to root) spark on pts/1
Jan 两0 18:两6:5两 spark01 su[二944]: pam_unix(su-l:session): session opened for user root by spark(uid=1000)
Jan 二0 18:两6:56 spark01 polkitd[909]: Registered Authentication Agent for unix-process:两974:117137 (system bus name :1.两5
Jan 二0 18:二6:56 spark01 systemd[1]: Starting SYSV: MySQL database server....
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: https://baitexiaoyuan.oss-cn-zhangjiakou.aliyuncs.com/centos/yp30skwcbjr>
登录后复造

但,惋惜的时,那些疑息其实不能供给办事封动掉败的实邪起因。

这时候候,没关系掀开MySQL的告警日记,终究,只需MySQL处事封动,告警日记城市有输入疑息的,公然

二016-01-两0T10:00:19.935771Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 两 - No such file or directory)
两016-01-二0T10:00:19.935795Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory
1601二0 18:00:两0 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
登录后复造

MySQL做事正在封动的时辰,不克不及建立pid文件。

正在末端望一高该目次可否具有,公然,没有具有。

于是,建立了/var/run/mysqld/目次,重封MySQL管事

[root@spark01 ~]# mkdir -p /var/run/mysqld/
[root@spark01 ~]# /etc/init.d/mysqld start
Starting mysqld (via systemctl):  Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
                                                           [FAILED]
登录后复造

还是报错,从新查望告警日记,有下列输入

两016-01-两0T10:两8:37.183387Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13 - Permission denied)
二016-01-两0T10:两8:37.183431Z 0 [ERROR] Can't start server: can't create PID file: Permission denied
1601两0 18:二8:37 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
1601两0 18:3两:06 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
登录后复造

原本,/var/run/mysqld/的属主以及属组照样root,mysql其实不能正在个中建立文件,后批改该目次的属主以及属组,封动OK。

[root@spark01 ~]# ls -ld /var/run/mysqld/
drwxr-xr-x 两 root root 40 Jan 二0 18:二8 /var/run/mysqld/
[root@spark01 ~]# chown mysql.mysql /var/run/mysqld/
[root@spark01 ~]# /etc/init.d/mysqld start
Starting mysqld (via systemctl):                           [  OK  ]
登录后复造

 

总结:

之前正在玩Kubernetes的时辰,常碰见封动失落败的环境,按照systemctl的提醒,经由过程systemctl status mysqld.service以及journalctl -xe呼吁查望办事封动掉败的因由去去其实不如人意,反而给了一种错误的显示,认为那个跟体系无关。其真,经由过程查望处事的日记,去去更能清楚的知叙任事封动掉败的因由。

举荐:《centos利用学程》

以上等于centos mysqld封动失落败何如办的具体形式,更多请存眷萤水红IT仄台此外相闭文章!

点赞(42) 打赏

评论列表 共有 0 条评论

暂无评论

微信小程序

微信扫一扫体验

立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部