今天,启动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
"htmlcode">-- -- Unit session-2.scope has begun starting up. Jan 20 18:26:48 spark01 sshd[2916]: pam_unix(sshd:session): session opened for user spark by (uid=0) Jan 20 18:26:52 spark01 su[2944]: (to root) spark on pts/1 Jan 20 18:26:52 spark01 su[2944]: pam_unix(su-l:session): session opened for user root by spark(uid=1000) Jan 20 18:26:56 spark01 polkitd[909]: Registered Authentication Agent for unix-process:2974:117137 (system bus name :1.25 Jan 20 18:26:56 spark01 systemd[1]: Starting SYSV: MySQL database server.... -- Subject: Unit mysqld.service has begun start-up -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mysqld.service has begun starting up. Jan 20 18:26:57 spark01 mysqld[2979]: MySQL Daemon failed to start. Jan 20 18:26:57 spark01 mysqld[2979]: Starting mysqld: [FAILED] Jan 20 18:26:57 spark01 systemd[1]: mysqld.service: control process exited, code=exited status=1 Jan 20 18:26:57 spark01 systemd[1]: Failed to start SYSV: MySQL database server.. -- Subject: Unit mysqld.service has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit mysqld.service has failed. -- -- The result is failed. Jan 20 18:26:57 spark01 systemd[1]: Unit mysqld.service entered failed state. Jan 20 18:26:57 spark01 systemd[1]: mysqld.service failed. Jan 20 18:26:57 spark01 polkitd[909]: Unregistered Authentication Agent for unix-process:2974:117137 (system bus name :1.但,可惜的时,这些信息并不能提供服务启动失败的真正原因。
这时候,不妨打开MySQL的告警日志,毕竟,只要MySQL服务启动,告警日志都会有输出信息的,果然
2016-01-20T10:00:19.935771Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory) 2016-01-20T10:00:19.935795Z 0 [ERROR] Can't start server: can't create PID file: No such file or directory 160120 18:00:20 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid endedMySQL服务在启动的时候,不能创建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]依旧报错,重新查看告警日志,有以下输出
2016-01-20T10:28:37.183387Z 0 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13 - Permission denied) 2016-01-20T10:28:37.183431Z 0 [ERROR] Can't start server: can't create PID file: Permission denied 160120 18:28:37 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended 160120 18:32: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 2 root root 40 Jan 20 18:28 /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 7下MySQL服务启动失败的快速解决方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]