如何解决Xamp中的“错误:MySQL意外关闭”?

问题描述 投票:0回答:4

当我打开 XAMPP 并单击启动 MySQL 按钮时,它给了我一个错误。我之前就开始了,但是现在不行了。

在 xammp 中给出以下错误

Error: MySQL shutdown unexpectedly.
This may be due to a blocked port, missing dependencies, 
improper privileges, a crash, or a shutdown by another method.
Press the Logs button to view error logs and check
the Windows Event Viewer for more clues
If you need more help, copy and post this
entire log window on the forums

以下是错误日志的内容:


2022-03-05 11:17:33 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2022-03-05 11:17:33 0 [Note] InnoDB: Uses event mutexes
2022-03-05 11:17:33 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-03-05 11:17:33 0 [Note] InnoDB: Number of pools: 1
2022-03-05 11:17:33 0 [Note] InnoDB: Using SSE2 crc32 instructions
2022-03-05 11:17:33 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2022-03-05 11:17:33 0 [Note] InnoDB: Completed initialization of buffer pool
2022-03-05 11:17:36 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2022-03-05 11:17:36 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-03-05 11:17:36 0 [Note] InnoDB: Setting file 'D:\xamp_7.2\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-03-05 11:17:36 0 [Note] InnoDB: File 'D:\xamp_7.2\mysql\data\ibtmp1' size is now 12 MB.
2022-03-05 11:17:36 0 [Note] InnoDB: Waiting for purge to start
2022-03-05 11:17:36 0 [Note] InnoDB: 10.4.13 started; log sequence number 5683247830; transaction id 653050
2022-03-05 11:17:36 0 [Note] InnoDB: Loading buffer pool(s) from D:\xamp_7.2\mysql\data\ib_buffer_pool
2022-03-05 11:17:36 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-03-05 11:17:36 0 [Note] InnoDB: Buffer pool(s) load completed at 220305 11:17:36
2022-03-05 11:17:36 0 [Note] Server socket created on IP: '::'.

这些错误的原因是什么以及如何纠正它们?

php mysql xampp
4个回答
10
投票

对我来说,打开并清空文件夹

multi-master.info
底部的文件
data
对我来说就足够了。


2
投票

打开数据文件夹并删除所有 ib_logfile*(ib_logfile0、ib_logfile1)。 然后重新启动xamp,这样就解决了我的问题。

参考: https://community.apachefriends.org/f/viewtopic.php?t=82071&p=276632


0
投票

造成此问题的原因有多种,以下是一些解决方案:

  1. 更改您的 MySQL 端口

导致“MySQL 意外关闭”错误的主要原因之一是另一个软件使用分配给 MySQL 的端口 3306。要验证这一点,您可以使用 XAMPP 控制面板中的 netstat 模块(位于 Shell 工具的正上方)。您可以通过简单地更改 mysql 端口来解决此问题并防止将来再次出现该问题。要更改它,请执行以下操作:

  • 点击右上角的Confing
  • 单击服务和端口设置
  • 选择MySQL,然后将3306更改为3307,然后单击保存
  • 在主 xammp 屏幕上,单击 mysql 的配置,然后选择 my.ini,然后搜索并将 3306 替换为使用的新端口号,在我们的示例中为 3307,然后保存
  • 重启xampp即可问题解决!但如果您的问题没有解决,请继续执行下面的解决方案 2
  1. 恢复数据库备份

此错误的另一个原因是数据库损坏,要修复它,只需恢复由 xampp 自动创建的数据库备份即可。默认情况下,您的 XAMPP MySQL 备份文件应位于“本地磁盘”>“XAMPP”>“MySQL”下。在该目录中,您将看到几个文件夹,其中两个文件夹称为数据和备份。数据文件夹包含数据库使用的所有文件。备份文件夹包含 MySQL 的一个最新副本。要恢复 MySQL 备份,请将数据文件夹的名称更改为其他名称,例如 data-old。然后将备份文件夹重命名为data。就是这样!


0
投票

只需 2 个步骤即可修复此错误:

  • 任务管理器
  • 找到MySQL->结束任务 返回 XAMPP -> star MySQL,端口 3306 应该可以再次工作。

如果您这样做,您也在该端口中使用的某些数据库可能会被删除,请确保您有一个副本,然后再继续。

© www.soinside.com 2019 - 2024. All rights reserved.