Sunday, January 31, 2010

Multiple MySQL Service conflict

Hi there,

At beginning of programming life, I installed MySQL 5 by downloading it directly from their website. I was using it with IIS (installed PHP) and it worked fine.

Later, I decided to not use IIS because my office programming interface was using Xampp and I was given no option because I need the Xampp to run Apache. I disabled my IIS and installed Xampp. All worked fine.

Until one fine day, I accidentally "Stop" and "Start" the MySQL service provided in Xampp Control Panel. As result of it, all my database went missing (no such DB anymore). I went panic until I understood that Xampp has its own MySQL Service offered in the bundle. In this case, when I clicked "Stop", it had actually stop my original MySQL service. And when I clicked "Start", it started the Xampp's bundled MySQL service. They both are 2 different service and has 2 different data folder.

Basically, the original MySQL service name would be "MySQL" and the Xampp bundled service name would be "mysql" (only the letter case are different).

The problem is, once the "mysql" service has been started (and stopped), the "MySQL" service cannot be started. It would show "Service unable to start. Error 0".

Googling further helped me to solve this issue with little trick of commenting out (disabling) a single line in the my.ini (MySQL's configuration file).
Reference: http://www.experts-exchange.com/Database/MySQL/Q_24356864.html

I comment out this line,
default-storage-engine=INNODB    (add # at beginning of line to comment out)
in the configuration file stored at this path,
C:\Program Files\MySQL\MySQL Server 5.0\my.ini   (your config file may be different depend on where you installed the original MySQL)

And then, start the "MySQL" service like this,
Run "SERVICES.MSC", look for "MySQL", right-click on it and select "Start".


Done, the service runs again like charm and I can access my databases again without crashing them ;)

Have fun guys!

No comments: