Jump to content
The Uniform Server Community
Sign in to follow this  
acicovic

Restarting Windows corrupts database

Recommended Posts

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! :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.com/doc/refman/5.7/en/forcing-innodb-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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...