简体   繁体   English

XAMPP:MySQL无法启动

[英]XAMPP: MySQL not starting

I was in the middle of developing my site and both apache and mysql were running normally until suddenly, the database failed to connect. 我正处于开发站点的过程中,apache和mysql都正常运行,直到突然之间,数据库无法连接。 I checked my XAMPP control panel and MySQL had stopped running. 我检查了XAMPP控制面板,MySQL停止运行。 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. 在这里搜索了一个解决方案以及关于SO的其他一些类似问题,但是我一直没有找到适合我的解决方案。 Here is the contents of mysql_error.log file: 这是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

What i have tried until now: 到目前为止我尝试过的是:

  • i have changed to port address for from 3306 to 3307, 3310. Didn't work. 我已将端口地址从3306更改为3307、3310。没有用。
  • i deleted ibdata1 file. 我删除了ibdata1文件。 Although the file reappeared back in its place after i attempted to restart MySQL. 虽然在我尝试重新启动MySQL之后,文件重新出现在原位。 (I learnt later that i would lose my tables if ibdata1 is missing. i don't want that.) (我后来才知道,如果ibdata1丢失了,我会丢失表。我不想要那样。)

Why did MySQL suddenly run into problems and and how to start MySQL without losing my tables? 为什么MySQL突然遇到问题,以及如何在不丢失表的情况下启动MySQL?

There are several reason MySql keeps shutting down unexpectedly. MySql一直意外关闭的原因有很多。

I am assuming that you have not installed multiple mysql server versions in the same machine. 我假设您尚未在同一台计算机上安装多个mysql服务器版本。

  1. Stop Mysql service from xampp control panel or stop it manually from services.msc and quit the xampp control panel. 从xampp控制面板停止Mysql服务,或者从services.msc手动停止它,然后退出xampp控制面板。
  2. Delete these two log files (ib_logfile0 and ib_logfile1) from xampp/mysql/ directory. 从xampp / mysql /目录中删除这两个日志文件(ib_logfile0和ib_logfile1)。 (Note: I am not sure about the exact path of log files, check in all the folders of xampp/mysql/ directory) (注意:我不确定日志文件的确切路径,请检入xampp / mysql /目录的所有文件夹)
  3. Restart Mysql service manually from services.msc 从services.msc手动重新启动Mysql服务
  4. open xampp control panel, you should see mysql is running. 打开xampp控制面板,您应该看到mysql正在运行。

I also see your innodb_buffer_pool_size is very low. 我还看到您的innodb_buffer_pool_size非常低。

Increase the buffer_pool_size to about 50-60% of your RAM. 将buffer_pool_size增加到大约RAM的50-60%。 For example, If you have 2GB ram, then set buffer_pool_size= 1GB 例如,如果您有2GB内存,则将buffer_pool_size = 1GB

run this query in mysql. 在mysql中运行此查询。

set innodb_buffer_pool_size=1073741824;

or 要么

set global innodb_buffer_pool_size=1073741824;

restart mysql server. 重启mysql服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM