系统环境:
CENTOS7, XAMPP
找到日志位置:
/opt/lampp/var/mysql/instance-7srte5br.err
错误日志如下:
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: The InnoDB memory heap is disabled
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: Compressed tables use zlib 1.2.8
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: Using SSE crc32 instructions
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: Initializing buffer pool, size = 32.0M
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: Completed initialization of buffer pool
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: Highest supported file format is Barracuda.
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: Starting crash recovery from checkpoint LSN=539566569
2018-12-19 19:02:20 140493164005184 [Note] InnoDB: Restoring possible half-written data pages from the doublewrite buffer...
InnoDB: Set innodb_force_recovery to ignore this error.
2018-12-19 19:02:20 140493164005184 [ERROR] Plugin 'InnoDB' init function returned error.
2018-12-19 19:02:20 140493164005184 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-12-19 19:02:20 140493164005184 [Note] Plugin 'FEEDBACK' is disabled.
2018-12-19 19:02:20 140493164005184 [ERROR] Unknown/unsupported storage engine: InnoDB
2018-12-19 19:02:20 140493164005184 [ERROR] Aborting
产生原因:
这和my.cnf配置有关,常常是服务器配置太低,流量太大导致mysql异常
解决办法:
1,先配置my.cnf文件如下:
# The MySQL server [mysqld] key_buffer = 256M max_allowed_packet = 64M table_open_cache = 64 sort_buffer_size = 2M net_buffer_length = 16K read_buffer_size = 4M read_rnd_buffer_size = 4M myisam_sort_buffer_size = 64M # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high innodb_buffer_pool_size = 1024M innodb_log_file_size = 10M innodb_log_buffer_size = 16M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 100 [isamchk] key_buffer = 256M sort_buffer_size = 20M read_buffer = 4M write_buffer = 4M [myisamchk] key_buffer = 256M sort_buffer_size = 20M read_buffer = 4M write_buffer = 4M
2,停止MYSQL服务,并删除
/opt/lampp/var/mysql/ib_logfile0
/opt/lampp/var/mysql/ib_logfile1
这两个文件
3,重启MYSQL服务即可
4,其他注意事项:可以备份需要删除的文件,再恢复时注意文件权限