mysql - XAMPP:MySQL 未启动

标签 mysql xampp

我正在开发我的网站,apache和mysql都正常运行,直到突然数据库无法连接。我检查了我的 XAMPP 控制面板,MySQL 已停止运行。我寻找解决方案here以及其他一些类似的问题,但我一直无法找到适合我的解决方案。以下是 mysql_error.log 文件的内容:

2016-04-15 20:30:18 150c InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
160415 20:30:18 [Note] InnoDB: Using mutexes to ref count buffer pool pages
160415 20:30:18 [Note] InnoDB: The InnoDB memory heap is disabled
160415 20:30:18 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
160415 20:30:18 [Note] InnoDB: Memory barrier is not used
160415 20:30:18 [Note] InnoDB: Compressed tables use zlib 1.2.3
160415 20:30:18 [Note] InnoDB: Not using CPU crc32 instructions
160415 20:30:18 [Note] InnoDB: Initializing buffer pool, size = 16.0M
160415 20:30:18 [Note] InnoDB: Completed initialization of buffer pool
160415 20:30:18 [Note] InnoDB: Restoring page 0 of tablespace 0
160415 20:30:18 [Warning] InnoDB: Doublewrite does not have page_no=0 of space: 0
160415 20:30:18 [ERROR] InnoDB: space header page consists of zero bytes in data file D:\xampp\mysql\data\ibdata1
160415 20:30:18 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
160415 20:30:18 [ERROR] Plugin 'InnoDB' init function returned error.
160415 20:30:18 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
160415 20:30:18 [Note] Plugin 'FEEDBACK' is disabled.
160415 20:30:18 [ERROR] Unknown/unsupported storage engine: InnoDB
160415 20:30:18 [ERROR] Aborting

160415 20:30:18 [Note] D:\xampp\mysql\bin\mysqld.exe: Shutdown complete

到目前为止我已经尝试过:

  • 我已将端口地址从 3306 更改为 3307、3310。但不起作用。
  • 我删除了 ibdata1 文件。尽管在我尝试重新启动 MySQL 后该文件又重新出现在原来的位置。 (后来我了解到,如果 ibdata1 丢失,我将丢失我的表。我不希望这样。)

为什么 MySQL 突然遇到问题以及如何在不丢失表的情况下启动 MySQL?

最佳答案

MySql 不断意外关闭有多种原因。

我假设您没有在同一台计算机上安装多个 mysql 服务器版本。

  1. 从 xampp 控制面板停止 Mysql 服务,或从 services.msc 手动停止 Mysql 服务并退出 xampp 控制面板。
  2. 从 xampp/mysql/目录中删除这两个日志文件(ib_logfile0 和 ib_logfile1)。 (注:我不确定日志文件的具体路径,请检查xampp/mysql/目录下的所有文件夹)
  3. 从 services.msc 手动重启 Mysql 服务
  4. 打开xampp控制面板,您应该看到mysql正在运行。

我还发现您的 innodb_buffer_pool_size 非常低。

将 buffer_pool_size 增加到 RAM 的 50-60% 左右。例如,如果您有 2GB 内存,则设置 buffer_pool_size= 1GB

在 mysql 中运行此查询。

set innodb_buffer_pool_size=1073741824;

set global innodb_buffer_pool_size=1073741824;

重新启动mysql服务器。

关于mysql - XAMPP:MySQL 未启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36650997/

相关文章:

mysql 两表连接总和不相等结果

mysql - 如何在 MySQL 中将时间戳转换为日期时间?

mysql - Visual Basic 2010 Express 中的 MySQL 连接困难

php - 从函数内访问保存数据库查询结果的数组

php - 错误 : Apache shutdown unexpectedly error message

android - 我的 android 应用程序无法访问我的计算机的本地主机

mysql - Php 连接时出现重复行

ruby - 安装可移植 ruby​​ 和可移植 xampp 以便在我的 Windows 机器 : Is that possible? 中使用 compass 和 sass

linux - andLinux + LAMPP 比XAMPP 好?

apache - ServerRoot,DocumentRoot和目录之间的区别