Jump to content


Photo

Restarting Windows corrupts database

mysql database corruption restart

  • Please log in to reply
2 replies to this topic

#1 acicovic

acicovic

    Newbie

  • Member
  • Pip
  • 2 posts
  • Main OS: Windows 7

Posted 17 August 2015 - 04:43 AM

Hello there,

 

Running Windows 7 x64 with UniServer latest version (11_8_0_ZeroXI), and update to MySQL 5.6.26.

 

If I restart the computer without shutting down MySQL from UniController first, MySQL is not shut down gracefully (I assume this because I see no traces of shutting down in the log). Upon reboot, and when I will try to start the MySQL server, it will not start and I will get a log like that:

 

 

Version: '5.6.26'  socket: ''  port: 3306  MySQL Community Server (GPL)
2015-08-16 23:21:50 4376 [Note] Plugin 'FEDERATED' is disabled.
2015-08-16 23:21:50 4376 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-08-16 23:21:50 4376 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-16 23:21:50 4376 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-08-16 23:21:50 4376 [Note] InnoDB: Memory barrier is not used
2015-08-16 23:21:50 4376 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-16 23:21:50 4376 [Note] InnoDB: Not using CPU crc32 instructions
2015-08-16 23:21:50 4376 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2015-08-16 23:21:50 4376 [Note] InnoDB: Completed initialization of buffer pool
2015-08-16 23:21:50 4376 [Note] InnoDB: Highest supported file format is Barracuda.
2015-08-16 23:21:50 4376 [Note] InnoDB: The log sequence numbers 104865222 and 104865222 in ibdata files do not match the log sequence number 104865232 in the ib_logfiles!
2015-08-16 23:21:50 4376 [Note] InnoDB: Database was not shutdown normally!
2015-08-16 23:21:50 4376 [Note] InnoDB: Starting crash recovery.
2015-08-16 23:21:50 4376 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-08-16 23:21:52 4376 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace mysql/innodb_table_stats uses space ID: 1 at filepath: .\mysql\innodb_table_stats.ibd. Cannot open tablespace phpmyadmin/pma__bookmark which uses space ID: 1 at filepath: .\phpmyadmin\pma__bookmark.ibd
InnoDB: Error: could not open single-table tablespace file .\phpmyadmin\pma__bookmark.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.

 

Is this a known issue? is there a fix to this?

 

Thanks! :)



#2 acicovic

acicovic

    Newbie

  • Member
  • Pip
  • 2 posts
  • Main OS: Windows 7

Posted 17 August 2015 - 07:58 AM

I've also tried uWamp and although MySQL manages to restart, the log states that MySQL has not been shut down correctly and then a successful recovery takes place. However, this is not optimal, as recovery may at some point fail.

 

My conclusion after testing UniServer and uWamp is that Windows does not shut down MySQL gracefully when it is running as a process vs a service (on my local setup as a service shutdown is done gracefully).

 

I do not know if this can be solved.



#3 d.helfensteller

d.helfensteller

    Newbie

  • Member
  • Pip
  • 1 posts
  • Main OS: Windows 7

Posted 15 December 2015 - 08:54 AM

I ran into the same issue today and the fix which helped me out was quick as pointed out in the log-file: "... you can set innodb_force_recovery > 0 in my.cnf"

https://dev.mysql.co...b-recovery.html

 

This will not generally fix the issue / bug, but it will make the DB accessible again:

 

1. I edited the file core\mysql\my.ini and added after [mysqld] : innodb_force_recovery = 1

2. Restarted the SQL-Server

3. Removed the formerly added line

4. Restarted the SQL-Server again

 

So it was just a matter of seconds, everythings working fine again.







Also tagged with one or more of these keywords: mysql, database corruption, restart

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users