Tuesday, July 12, 2011

MySQL Service won't start on Windows 7

So today, I attempted to install MySQL on Windows 7.  From the MySQL Download site, I grabbed the latest version of their .msi installer,  mysql-installer-5.5.13.2.msi.  I went through the installer, and found that the last step, starting the MySQL services (mysqld) was failing.  The service existed in services.msc, and in the registry, but it refused to start.  Attempting to start it from the command line ("NET START MySQL") failed, giving the following output:

The MySQL service is starting...
The MySQL service could not be started.

A system error has occurred.

System error 1067 has occurred.

The process terminated unexpectedly.

Very descriptive. Thanks.  I tried checking for a log file from MySQL, but could't find it. Strange.  Well, it turns out, MySQL on windows has its data directory at C:\ProgramData\MySQL\MySQL Server 5.5\data.   You can verify this in your installation by looking at the my.ini file, in your MySQL installation directory (probably C:\Program Files (x86)\MySQL\MySQL Server 5.5\), and finding the line that says datadir=...

I didn't even know ProgramData existed!  It's hidden, so either unhide it (Control Panel -> Folder Options -> Show hidden...) or simply enter c:\ProgramData into your explorer title bar.  In this data directory, there should exist the log file [hostname].err.  Taking a glance at that, I found:

InnoDB: Error: log file .\ib_logfile0 is of different size 0 33554432 bytes
InnoDB: than specified in the .cnf file 0 56623104 bytes!

Thanks to this post on forums.mysql.com, I found that simply deleting ib_logfile0 and ib_logfile1 solved the problem.  Seems like a dumb installer mistake to me!  A bug report already exists, so I'll just keep quiet until the next install :-)  Hope this helps!

1 comment:

  1. It also needs a good mug of coffee in the morning. I dumped one all over my laptop when it stopped working and all my problems were solved.

    ReplyDelete