记录phpstudy的mysql启动不起来的一种情况及解决办法
①首先排除了端口占用
根据错误日志,发现了一些问题

情况

启动服务后的情况
在这里插入图片描述

错误日志

日志文件:phpStudy\PHPTutorial\MySQL\data\Arch.err

220504 21:24:45 [Note] Plugin 'FEDERATED' is disabled.
D:\phpStudy\PHPTutorial\MySQL\bin\mysqld.exe: Table 'mysql.plugin' doesn't exist
220504 21:24:45 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
220504 21:24:45 InnoDB: The InnoDB memory heap is disabled
220504 21:24:45 InnoDB: Mutexes and rw_locks use Windows interlocked functions
220504 21:24:45 InnoDB: Compressed tables use zlib 1.2.3
220504 21:24:45 InnoDB: Initializing buffer pool, size = 47.0M
220504 21:24:45 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
220504 21:24:45  InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
220504 21:24:45  InnoDB: Log file .\ib_logfile0 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile0 size to 24 MB
InnoDB: Database physically writes the file full: wait...
220504 21:24:45  InnoDB: Log file .\ib_logfile1 did not exist: new to be created
InnoDB: Setting log file .\ib_logfile1 size to 24 MB
InnoDB: Database physically writes the file full: wait...
220504 21:24:45  InnoDB: Operating system error number 87 in a file operation.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
InnoDB: File name .\ib_logfile0
InnoDB: File operation call: 'aio write'.
InnoDB: Cannot continue operation.

排查错误

错误1 硬盘扇区大小 导致的问题

220504 21:24:45  InnoDB: Operating system error number 87 in a file operation.

解决办法
打开my.ini配置文件,找到innodb_flush_method配置项,更改配置值为normal。 如果没有找到该配置项,则直接在配置文件里的[mysqld]节点增加一行新配置:

innodb_flush_method=normal

参考

错误2 缺少VC运行库

D:\phpStudy\PHPTutorial\MySQL\bin\mysqld.exe: Table 'mysql.plugin' doesn't exist
220504 21:24:45 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

我的电脑缺少了VC14运行库,所以初始化mysql不成功 排查了很久才发现的。
缺少运行库导致创建不了下面这几个数据库和文件(主要是创建不了mysql这个数据库,也就是上面错误日志中的mysql.plugin 不存在的错误)
在这里插入图片描述

启动mysql后又自动停止,并且data目录下只有这四个文件data目录解决办法:
PHPstudy要求VC9-VC14的运行库(X86和X64都建议安装)。所以需要确保已安装好VC运行库。(可以用directx修复DirectX Repair

在这里插入图片描述

当我安装好VC运行库后,
重新安装phpstudy
②在my.ini文件的[mysqld]节点下添加
innodb_flush_method=normal
③启动mysql正常运行

在这里插入图片描述

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐