XAMPP: MySQL not starting

时间:2016-04-15 15:19:31

标签: mysql xampp

I was in the middle of developing my site and both apache and mysql were running normally until suddenly, the database failed to connect. I checked my XAMPP control panel and MySQL had stopped running. I searched for a solution here and some other similar questions on SO but i haven't been able to find a solution that works for me. Here is the contents of mysql_error.log file:

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

What i have tried until now:

  • i have changed to port address for from 3306 to 3307, 3310. Didn't work.
  • i deleted ibdata1 file. Although the file reappeared back in its place after i attempted to restart MySQL. (I learnt later that i would lose my tables if ibdata1 is missing. i don't want that.)

Why did MySQL suddenly run into problems and and how to start MySQL without losing my tables?

1 个答案:

答案 0 :(得分:0)

MySql意外关闭有几个原因。

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

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

    将buffer_pool_size增加到RAM的大约50-60%。例如,如果你有2GB ram,那么设置buffer_pool_size = 1GB

    在mysql中运行此查询。

    set innodb_buffer_pool_size=1073741824;
    

    set global innodb_buffer_pool_size=1073741824;
    

    重启mysql服务器。