我的 MySQL 无法启动,显示如下:
10:55:53 ق.ظ [mysql] Status change detected: stopped
10:55:53 ق.ظ [mysql] Error: MySQL shutdown unexpectedly.
10:55:53 ق.ظ [mysql] This may be due to a blocked port, missing dependencies,
10:55:53 ق.ظ [mysql] improper privileges, a crash, or a shutdown by another method.
10:55:53 ق.ظ [mysql] Press the Logs button to view error logs and check
10:55:53 ق.ظ [mysql] the Windows Event Viewer for more clues
10:55:53 ق.ظ [mysql] If you need more help, copy and post this
10:55:53 ق.ظ [mysql] entire log window on the forums
然后这是错误日志:
2022-09-29 10:55:51 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2022-09-29 10:55:51 0 [Note] InnoDB: Uses event mutexes
2022-09-29 10:55:51 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-09-29 10:55:51 0 [Note] InnoDB: Number of pools: 1
2022-09-29 10:55:51 0 [Note] InnoDB: Using SSE2 crc32 instructions
2022-09-29 10:55:51 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2022-09-29 10:55:51 0 [Note] InnoDB: Completed initialization of buffer pool
2022-09-29 10:55:51 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2022-09-29 10:55:51 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-09-29 10:55:51 0 [Note] InnoDB: Setting file 'C:\xampp\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-09-29 10:55:51 0 [Note] InnoDB: File 'C:\xampp\mysql\data\ibtmp1' size is now 12 MB.
2022-09-29 10:55:51 0 [Note] InnoDB: Waiting for purge to start
2022-09-29 10:55:51 0 [Note] InnoDB: 10.4.22 started; log sequence number 1463371418; transaction id 661011
2022-09-29 10:55:51 0 [Note] InnoDB: Loading buffer pool(s) from C:\xampp\mysql\data\ib_buffer_pool
2022-09-29 10:55:51 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-09-29 10:55:51 0 [Note] Server socket created on IP: '::'.
Windows 事件查看器中出现错误:
日志名称:应用程序 资料来源:MariaDB 日期: 07/07/1401 11:32:33 ق.ٸ 事件ID:100 任务类别:无 级别:错误 关键词:经典 用户:不适用 电脑:DESKTOP-33KUAJ5 描述: 无法找到源 MariaDB 中事件 ID 100 的描述。您的本地计算机上未安装引发此事件的组件,或者安装已损坏。您可以在本地计算机上安装或修复该组件。
如果事件源自另一台计算机,则显示信息必须与事件一起保存。
活动中包含以下信息:
正在中止
消息资源存在,但在消息表中未找到该消息
事件XML:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="MariaDB" />
<EventID Qualifiers="49152">100</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2022-09-29T08:02:33.6734979Z" />
<EventRecordID>20403</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>DESKTOP-33KUAJ5</Computer>
<Security />
</System>
<EventData>
<Data>Aborting
</Data>
</EventData>
</Event>
这些错误的原因是什么以及如何修复?
这就是为我解决的方法:
打开 shell 并使用以下命令启动 MySQL:
mysqld –-console –-skip-grant-tables –-skip-external-locking
使用此命令修复数据库:
mysqlcheck -r --databases mysql --use-frm
停止 MySQL,从 XAMP 重新启动 MySQL。
来源:MySQL 论坛
@ampagi 答案对我有用 - 但我首先需要删除 /xamp/mysql/data 目录中的额外 my.ini 文件。