mysql服务无法启动

数据库服务使用时突然终止,无法启动,

查看日志:

2017-11-15T07:32:52.412019Z 0 [Note] Basedir set to C:\Program Files\MySQL\MySQL Server 8.0\
2017-11-15T07:32:52.415277Z 0 [Warning] option 'read_buffer_size': unsigned value 0 adjusted to 8192
2017-11-15T07:32:52.415289Z 0 [Warning] option 'read_rnd_buffer_size': unsigned value 0 adjusted to 1
2017-11-15T07:32:52.415322Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2017-11-15T07:32:52.418098Z 0 [Note] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.2-dmr-log) starting as process 2736 ...
2017-11-15T07:32:52.434234Z 0 [Note] InnoDB: Adjusting innodb_buffer_pool_instances from 8 to 1 since innodb_buffer_pool_size is less than 1024 MiB
2017-11-15T07:32:52.434700Z 0 [Note] Plugin 'FEDERATED' is disabled.
2017-11-15T07:32:52.437297Z 1 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2017-11-15T07:32:52.437568Z 1 [Note] InnoDB: Uses event mutexes
2017-11-15T07:32:52.437729Z 1 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2017-11-15T07:32:52.437984Z 1 [Note] InnoDB: Compressed tables use zlib 1.2.3
2017-11-15T07:32:52.438426Z 1 [Note] InnoDB: Number of pools: 1
2017-11-15T07:32:52.438649Z 1 [Note] InnoDB: Using CPU crc32 instructions
2017-11-15T07:32:52.447289Z 1 [Note] InnoDB: Initializing buffer pool, total size = 8M, instances = 1, chunk size = 8M
2017-11-15T07:32:52.448089Z 1 [Note] InnoDB: Completed initialization of buffer pool
2017-11-15T07:32:52.472095Z 1 [Note] InnoDB: The log sequence number 15016608 in the system tablespace does not match the log sequence number 16552391 in the ib_logfiles!
2017-11-15T07:32:52.472528Z 1 [Note] InnoDB: Database was not shutdown normally!
2017-11-15T07:32:52.472717Z 1 [Note] InnoDB: Starting crash recovery.
2017-11-15T07:32:52.473169Z 1 [Note] InnoDB: Using 'tablespaces.open.1' max LSN: 16526055
2017-11-15T07:32:52.498786Z 1 [Note] InnoDB: Doing recovery: scanned up to log sequence number 16981365
2017-11-15T07:32:52.511278Z 1 [Note] InnoDB: Applying a batch of 24 redo log records ...
2017-11-15T07:32:52.570961Z 1 [Note] InnoDB: 100%
2017-11-15T07:32:53.076458Z 1 [Note] InnoDB: Apply batch completed!
2017-11-15T07:32:53.220749Z 1 [Note] InnoDB: Opened 2 existing undo tablespaces.
2017-11-15T07:32:53.492610Z 1 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2017-11-15T07:32:53.492877Z 1 [Note] InnoDB: Creating shared tablespace for temporary tables
2017-11-15T07:32:53.494638Z 1 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2017-11-15T07:32:53.540395Z 1 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB.
2017-11-15T07:32:53.543239Z 1 [Note] InnoDB: Created 128 and tracked 128 new rollback segment(s) in the temporary tablespace. 128 are now active.
2017-11-15T07:32:53.548565Z 1 [Note] InnoDB: 8.0.2 started; log sequence number 16981365
2017-11-15T07:32:53.678980Z 0 [Note] InnoDB: Loading buffer pool(s) from C:\ProgramData\MySQL\MySQL Server 8.0\Data\ib_buffer_pool
2017-11-15T07:32:53.679768Z 0 [Note] InnoDB: Buffer pool(s) load completed at 171115 15:32:53
2017-11-15T07:32:53.686907Z 0 [ERROR] InnoDB: Assertion failure: trx0purge.cc:167:purge_sys->iter.trx_no <= purge_sys->rseg->last_trx_no
InnoDB: thread 1296
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/8.0/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
2017-11-15T07:32:53.695395Z 1 [Note] Found data dictionary with version 1
2017-11-15T07:32:53.717725Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2017-11-15T07:32:53.718126Z 0 [Note] Server hostname (bind-address): '*'; port: 3307
2017-11-15T07:32:53.718574Z 0 [Note] IPv6 is available.
2017-11-15T07:32:53.718750Z 0 [Note]   - '::' resolves to '::';
2017-11-15T07:32:53.718913Z 0 [Note] Server socket created on IP: '::'.
2017-11-15T07:32:53.744417Z 0 [Note] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: '8.0.2-dmr-log'  socket: ''  port: 3307  MySQL Community Server (GPL)

解决:

1. 在mysql的配置文件中增加参数:数值是1-6 ,我这里用了2就可以启动了
innodb_force_recovery = 2
2. 启动后再向库里表做dml操作会报错,服务直接停止不能操作
3. 首先将库里的数据导出来
4. 删除ibdata1  ib_logfile* 这些文件, 重新启动数据库,这时会重建ibdata1  ib_logfile* 这些文件或者重新安装新数据库
5.将到导出的数据还原到数据库

猜你喜欢

转载自my.oschina.net/u/3010171/blog/1573989