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:
    • Uninstall MySQL (Add/remove programs, etc.)
    • Delete the MySQL program directory
    • 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!

28 comments

Archived from the site's previous comment system. New comments are closed.

gadgetfann

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!

KrisGielen

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.

Pedro

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!

fabio

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

MartinodF

Run into this while installing MySQL 5.6 on W8.1 64bit. Fix works perfectly, thanks!

JC

The innodb_flush_method=normal is what fixed it for me... didn't need to reinstall anything..
I did stop installation process when attempting to start the service, and just added that line in the my.ini file
so more likely didn't need to stop the installation process so it can finish regularly.

FrancescoAnz

Thank you! I had the same trouble on an Asus tablet model T100 come with windows 8.1 and SSD. Now it works!!!

Gilian

Exact same tablet, exact same problem (and solution). :) This post is definitely a lifesaver!

Andy Mc

Great, got it working thanks but needed an extra line. This is what I added to my.cnf...

innodb_flush_method = normal
innodb_force_recovery = 1

Thx aLot

It Works !!!!

Jay-r

Thanks man you're awesome

Firenze LU

The line works for my W8.1 tablet. You're great!

pablonowakowski

thanks works great on transformer t100! I thought sth is wrong with my xampp...

roadworrier

thank you!!!!

Diana Cristina Aguilar

Hola yo cambie la ruta de mi base de datos y me sale el error 2003 y regreso la carpeta data al lugar de origen y funciona perfecto.
Esa linea que ustedes dicen donde se coloca para ver si me funciona.
Ya me estoy volviendo loca. he modificado el archivo my.ini
Para que me funcione debo dejar todo como se instala.
que hago

Nico

Genial, miles de gracias
innodb_flush_method=normal is the solution
3 days lost with this problem, and you done the solution
thank you very much

angela

Hi ..
I installed my-SQL at my tablet which has window 8.
I have a same problem.
After I added

innodb_flush_method = normal
innodb_force_recovery = 1

It seemed work but When the tablet was discharged than it happened again.
What should I do?

Kenneth Richards

Thanks a ton for this information. Had the exact same issue on Windows 8.1 after moving my Xampp install of Mysql to a new memory card.

Eghaghara Ese

You are good works for me

Hritik Vijay

Thanks man !
It helped a lot!
Keep on the good work :)

wira buana

Awesome...!!!

LUCA

Thanks man,
you have literally saved my life. I spent so many days to find a solution :-S
Awesomeeeeeeeee

Pete

Yes it works!!!!
Resolved this issue on a solid state HDD machine.
There is an issue with how these DB files are stored on such hardware.

Thanks alot!!!!

z3d0

Thanks a lot, solved my mysql error 1067 on windows 10!!!

Dmitry

God save you, man.

angua

Bless you people, solved my problem with mysql on ASUS T100 as well

Marek

Thanks, half a day spent on fixing it. You saved my day!

Ray Erasmus

Life saver! Bless you for this. Four days of misery change to joy with one config line.