mysql下载starting the serverMysql重启报pid⽂件丢失(持续更新)
mysql重启后报错
信息如下
>>>>>>>>>>#
Redirecting to /bin/systemctl start mysql.service
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xe" for details.
>>>>>>>>>>
查看服务运⾏信息
systemctl status mysqld.service
>>>>>>>>>>
● mysqld.service - LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysqld; generated)
Active: failed (thawing) (Result: exit-code) since Thu 2021-04-08 23:22:55 PDT; 6min ago
Docs: man:systemd-sysv-generator(8)
Process: 13546 ExecStop=/etc/rc.d/init.d/mysqld stop (code=exited, status=0/SUCCESS)
Process: 33545 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE)
Apr 08 23:22:54 primary systemd[1]: Starting LSB: start and
Apr 08 23:22:55 primary mysqld[33545]: Starting MySQL. ERROR! The server quit without updating PID file (/var/run/mysqld/mysqld.pid). Apr 08 23:22:55 primary systemd[1]: mysqld.service: Control process exited, code=exited status=1
Apr 08 23:22:55 primary systemd[1]: mysqld.service: Failed with result 'exit-code'.
Apr 08 23:22:55 primary systemd[1]: Failed to start LSB: start and stop MySQL.
>>>>>>>>>>
情形⼀.异常数据⽂件影响服务启动
截取错误⽇志/var/log/mysqld.log
>>>>>>>>>>
2021-04-09T06:38:24.889010Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --
explicit_defaults_for_timestamp server option (see documentation for more details).
2021-04-09T06:38:24.889074Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2021-04-09T06:38:24.889090Z 0 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.7.23-log) starting as process 35083 ...
mysqld: File '/usr/local/mysql/bin-log/master-bin.index' not found (Errcode: 21 - Is a directory)
2021-04-09T06:38:24.895144Z 0 [ERROR] Aborting
2021-04-09T06:38:24.895151Z 0 [Note] Binlog end
2021-04-09T06:38:24.895251Z 0 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
>>>>>>>>>>
⽇志说未到/usr/local/mysql/bin-log/master-bin.index⽂件
迁移或清空对应路径下⽂件master-bin.index后恢复
mv master-bin.index master-bin.index.bak
再次重启后成功
具体什么原因最好的办法是先查看下错误⽇志:
1、可能是/usr/local/mysql/data/mysql.pid⽂件没有写的权限
解决⽅法:给予权限,执⾏ “chown -R mysql:mysql /var/data” “chmod -R 755 /usr/local/mysql/data” 然后重新启动mysqld!
2、可能进程⾥已经存在mysql进程
解决⽅法:⽤命令“ps -ef|grep mysqld”查看是否有mysqld进程,如果有使⽤“kill -9 进程号”杀死,然后重新启动mysqld!
3、可能是第⼆次在机器上安装mysql,有残余数据影响了服务的启动。
解决⽅法:去mysql的数据⽬录/data看看,如果存在mysql-bin.index,就赶快把它删除掉吧,它就是罪魁祸⾸了。本⼈就是使⽤第三条⽅法解决的!
4、mysql在启动时没有指定配置⽂件时会使⽤/etc/myf配置⽂件,请打开这个⽂件查看在[mysqld]节下有没有指定数据⽬录(datadir)。
解决⽅法:请在[mysqld]下设置这⼀⾏:datadir = /usr/local/mysql/data
5、skip-federated字段问题
解决⽅法:检查⼀下/etc/myf⽂件中有没有没被注释掉的skip-federated字段,如果有就⽴即注释掉吧。
6、错误⽇志⽬录不存在
解决⽅法:使⽤“chown” “chmod”命令赋予mysql所有者及权限
7、selinux惹的祸,如果是centos系统,默认会开启selinux
解决⽅法:关闭它,打开/etc/selinux/config,把SELINUX=enforcing改为SELINUX=disabled后存盘退出重启机器试试。
情形⼆.⾮正常关机导致pid⽂件丢失
截取错误⽇志/var/log/mysqld.log
>>>>>>>>>>
2021-04-10T05:58:06.290754Z 0 [ERROR] InnoDB: Table mysql.innodb_table_stats not found.
2021-04-10T05:58:06.290791Z 0 [ERROR] InnoDB: Fetch of persistent statistics requested for id_executed but the required system tables mysql.innodb_table_stats and mysql.innodb_index_stats are not present or have un
expected structure. Using transient stats instead.
2021-04-10T05:58:06.291796Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2021-04-10T05:58:06.292262Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2021-04-10T05:58:06.292598Z 0 [Note] IPv6 is available.
2021-04-10T05:58:06.292609Z 0 [Note] - '::' resolves to '::';
2021-04-10T05:58:06.292634Z 0 [Note] Server socket created on IP: '::'.
2021-04-10T05:58:06.294492Z 0 [ERROR] Can't start server: can't check PID filepath: No such file or directory
>>>>>>>>>>
1.确认pid⽂件路径
more /etc/myf |grep -i pid
2.依照myf⽂件配置,创建对应的⽂件并修改权限(root特权执⾏)
mkdir -p /var/run/mysqld
chown mysql:mysql /var/run/mysqld
touch /var/run/mysqld/mysqld.pid
chown mysql:mysql /var/run/mysqld/mysqld.pid
3.再次尝试重启
情形三.如有⽤户权限启动问题,可尝试如下修改
cp /etc/init.d/mysqld mysqld.bak
修改mysql启动⽂件/etc/init.d/mysqld中start模块
添加--user=root到mysqld_safe
bindir/mysqld s afe−−user=root−−datadir="datadir" --pid-file="mysqld p id f ile p ath"other_args >/dev/null &
尝试重启
Processing math: 100%
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
mysql1.6安装方法_mysql数据的安装
下一篇 »
推荐文章
热门文章
-
随机森林算法的改进方法
2024-10-02 -
基于随机森林算法的风险预警模型研究
2024-10-02 -
Python中的随机森林算法详解
2024-10-02 -
随机森林发展历史
2024-10-02 -
如何使用随机森林进行时间序列数据模式识别(八)
2024-10-02 -
随机森林回归模型原理
2024-10-02 -
如何使用随机森林进行时间序列数据模式识别(六)
2024-10-02 -
如何使用随机森林进行时间序列数据预测(四)
2024-10-02 -
如何使用随机森林进行异常检测(六)
2024-10-02 -
随机森林算法和grandientboosting算法 -回复
2024-10-02 -
随机森林方法总结全面
2024-10-02 -
随机森林算法原理和步骤
2024-10-02 -
随机森林的原理
2024-10-02 -
随机森林 重要性
2024-10-02 -
随机森林算法
2024-10-02 -
机器学习中随机森林的原理
2024-10-02 -
随机森林算法原理
2024-10-02 -
使用计算机视觉技术进行动物识别的技巧
2024-10-02 -
基于crf命名实体识别实验总结
2024-10-02 -
transformer预测模型训练方法
2024-10-02
最新文章
-
随机森林算法介绍及R语言实现
2024-10-02 -
基于随机森林优化的神经网络算法在冬小麦产量预测中的应用研究_百度文 ...
2024-10-02 -
基于正则化贪心森林算法的情感分析方法研究
2024-10-02 -
随机森林算法和grandientboosting算法
2024-10-02 -
基于随机森林的图像分类算法研究
2024-10-02 -
随机森林结合直接正交信号校正的模型传递方法
2024-10-02
发表评论