Java自学者论坛

 找回密码
 立即注册

手机号码,快捷登录

恭喜Java自学者论坛(https://www.javazxz.com)已经为数万Java学习者服务超过8年了!积累会员资料超过10000G+
成为本站VIP会员,下载本站10000G+会员资源,会员资料板块,购买链接:点击进入购买VIP会员

JAVA高级面试进阶训练营视频教程

Java架构师系统进阶VIP课程

分布式高可用全栈开发微服务教程Go语言视频零基础入门到精通Java架构师3期(课件+源码)
Java开发全终端实战租房项目视频教程SpringBoot2.X入门到高级使用教程大数据培训第六期全套视频教程深度学习(CNN RNN GAN)算法原理Java亿级流量电商系统视频教程
互联网架构师视频教程年薪50万Spark2.0从入门到精通年薪50万!人工智能学习路线教程年薪50万大数据入门到精通学习路线年薪50万机器学习入门到精通教程
仿小米商城类app和小程序视频教程深度学习数据分析基础到实战最新黑马javaEE2.1就业课程从 0到JVM实战高手教程MySQL入门到精通教程
查看: 443|回复: 0

MySQL.. ERROR! The server quit without updating PID file问题解决

[复制链接]
  • TA的每日心情
    奋斗
    2024-4-6 11:05
  • 签到天数: 748 天

    [LV.9]以坛为家II

    2034

    主题

    2092

    帖子

    70万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    积分
    705612
    发表于 2021-4-22 15:26:58 | 显示全部楼层 |阅读模式

     不小心将服务器OS给重启了,再启动数据库的时候,出现了很奇怪的问题
    [root@dev run]# service mysql restart
    ERROR! MySQL server PID file could not be found!
    Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/run/mysql.pid).

    无法启动mysql,后来上网找了一下解决方法,无非就是以下几种

    1. 注释/etc/my.cnf里的skip-federated注释掉即#skip-federated;
    2. my.cnf文件配置过高,重新定义其中的参数(根据服务器情况定义);
    3. 杀掉mysql_safe和mysqld进程,然后再重启;
    4. 当前日志文件过大,超出了my.cnf中定义的大小(默认为64M),删除日志文件再重启;

    但是在主机中:

    1.        注释中无skip-federated这个选项
    2.        My.cnf是自己优化过的,断电之前正常使用,不是这个的问题
    3.        Ps –ef | grep mysql  根本就没有mysql的僵尸进程
    4.        没有这个问题
    基本上网上的所有方式都试过了,都无法解决问题,然后在数据库的data目录(mysql/data)查看错误日志,我的服务器是localhost.localdomain.err文件,也可能是
      (/var/lib/mysql/log/error.log)

    2014-06-10 11:52:46 15921 [Note] InnoDB: Database was not shutdown normally!
    2014-06-10 11:52:46 15921 [Note] InnoDB: Starting crash recovery.
    2014-06-10 11:52:46 15921 [Note] InnoDB: Reading tablespace information from the .ibd files...
    2014-06-10 11:52:46 15921 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace raildb/base_company_fullname uses space ID: 4 at filepath: ./raildb/base_company_fullname.ibd. Cannot open tablespace mysql/slave_master_info which uses space ID: 4 at filepath: ./mysql/slave_master_info.ibd
    2014-06-10 11:52:46 7ff29246d720  InnoDB: Operating system error number 2 in a file operation.
    InnoDB: The error means the system cannot find the path specified.
    InnoDB: If you are installing InnoDB, remember that you must create
    InnoDB: directories yourself, InnoDB does not create them.
    InnoDB: Error: could not open single-table tablespace file ./mysql/slave_master_info.ibd
    InnoDB: We do not continue the crash recovery, because the table may become
    InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
    InnoDB: To fix the problem and start mysqld:
    InnoDB: 1) If there is a permission problem in the file and mysqld cannot
    InnoDB: open the file, you should modify the permissions.
    InnoDB: 2) If the table is not needed, or you can restore it from a backup,
    InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
    InnoDB: crash recovery and ignore that table.
    InnoDB: 3) If the file system or the disk is broken, and you cannot remove
    InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
    InnoDB: and force InnoDB to continue crash recovery here.
    140610 11:52:46 mysqld_safe mysqld from pid file /var/lib/mysql/run/mysql.pid ended

    第一处标黄,提示是数据库没有正常关闭
    第二处标蓝,提示正在从.ibd files读取tablespace information
    第三处标红,就是开始error的地方,大概意思就是读取不到raildb这个库的tablespace
    下边说的就是一些处理这个问题的方法,就不一一翻译了

    最后我感觉是因为断电之前,mysql没有正常关闭,造成了raildb这个库的一些异常,我采用的解决方法是在innoDB,强制覆盖

    Vi /etc/my.cof  增加一行      innodb_force_recovery= 1

    然后重启,接着报错:

       mysqld: File './mysql-bin.index' not found (Errcode: 13)

    查看data目录下mysql-bin.index是存在的,怀疑是权限问题,对整个mysql目录重新赋权:

    chown -R mysql:mysql mysql

    再次重启,问题解决...

     

    哎...今天够累的,签到来了1...
    回复

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    QQ|手机版|小黑屋|Java自学者论坛 ( 声明:本站文章及资料整理自互联网,用于Java自学者交流学习使用,对资料版权不负任何法律责任,若有侵权请及时联系客服屏蔽删除 )

    GMT+8, 2024-5-9 20:22 , Processed in 0.073776 second(s), 29 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2021, Tencent Cloud.

    快速回复 返回顶部 返回列表