文章目录
- 情况
- 错误日志
- 排查错误
- 错误1 硬盘扇区大小 导致的问题
- 错误2 缺少VC运行库
记录phpstudy的mysql启动不起来的一种情况及解决办法
①首先排除了端口占用
根据错误日志,发现了一些问题
情况
启动服务后的情况
错误日志
日志文件:phpStudyPHPTutorialMySQLdataArch.err
220504 21:24:45 [Note] Plugin 'FEDERATED' is disabled.
D:phpStudyPHPTutorialMySQLbinmysqld.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:phpStudyPHPTutorialMySQLbinmysqld.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目录下只有这四个文件解决办法:
PHPstudy要求VC9-VC14的运行库(X86和X64都建议安装)。所以需要确保已安装好VC运行库。(可以用directx修复DirectX Repair)
当我安装好VC运行库后,
①重新安装phpstudy,
②在my.ini文件的[mysqld]节点下添加
innodb_flush_method=normal
③启动mysql正常运行