MySQL error 1067 – Windows error 87 – ERROR_INVALID_PARAMETER

The strangest thing happened to a MySQL server (running Windows Server 2003) I set up today. MySQL would install with no problem, work all day with no problem, then fail after a reboot. The MySQL service simply wouldn’t start, producing this error message:

Could not start the MySQL service on Local Computer.
Error 1067: The process terminated unexpectedly.

First I checked the my.ini file and saw no obvious problems (it was also the default my.ini file produced by the installer). Since the service wouldn’t start, I created a new one that made sure it was reading the right .ini file:

mysqld --install MySql2 --defaults-file="c:\my.ini"

… but to no avail, as the same error occurred. Eventually I gave up and reinstalled MySQL. But it still didn’t work!

I did learn two interesting things:

  • When trying to delete a service from Windows, make sure that the Services Manager is not open. The deleted service only gets truly deleted when the Services Manager is closed, which may leave you wondering why it’s taking so long (“This service is marked for deletion”).
  • When you need to reinstall MySQL, in order to really start fresh, you need to do three things:
    1. Uninstall MySQL (Add/remove programs, etc.)
    2. Delete the MySQL program directory
    3. Delete the MySQL data directory (under Documents and Settings, Application Data, etc.)

When I did a truly “fresh” install of MySQL, it actually worked again. But only till the next reboot. I found out when there was a power outage later during the day. MySQL wouldn’t start, and manually starting the service would produce, again, the error 1067.

This time I had a look at the MySQL log file, which lives in the data directory (called server001.err in my case). I found this:

120420  8:21:38  InnoDB: Operating system error number 87 in a file operation.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
InnoDB: File name .\ib_logfile0
InnoDB: File operation call: 'aio read'.
InnoDB: Cannot continue operation.

Ah, more information on the error. It turns out that Windows error 87 is ERROR_INVALID_PARAMETER; in other words: “The parameter is incorrect” (see here). Not particularly helpful, but it gets you something to Google for.

There weren’t too many Google results, but after I while I found this. It seems that the error is related to either the disk driver or the formatting of the disk (neither of which I could easily change on a remote server). But the bug report did include a workaround. Add this to my.ini:

innodb_flush_method=normal

And it works!


5 Comments

  1. gadgetfann says:

    This saved me in Windows 8 – I had installed MySQL 6 times before finding your solution, which solved the problem I was having. Thank you!

  2. KrisGielen says:

    Many thanks for this. I had the same issue and could not figure out what was going on, until I found your page.
    Just like gadgetfarm, I am running Windows 8.

  3. Pedro says:

    This was the solution that worked for me as well. I am also running windows 8 and wampserver. I was having the issue of the mysql service unable to start after rebooting. After doing this, the icon turns green and everything works. Thank you so much for posting this. After 3 days for searching and trying everything else, this definitely made my day!

  4. fabio says:

    thanks for this info, like others i was having problems on a damn w8 install
    thank you !!!


Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" cssfile="">