Install Apache and MySQL as a Service


Ok so you have successfully configured apache and MySQL on your windows machine, I know that Apache and MySQL automatically configure their services to auto start but in case if you cant see both or one of them into Microsoft -> Administrative Tools -> Services, and you want to configure so that both can start automatically on system startup.

So to install or configure a new service you will need command prompt (windows\system32\cmd.exe) go to this directory right click on cmd.exe and click on Run as Administrator (otherwise windows will not allow you to add a service)

Install Apache as a service

First go to apache\bin directory

D:\>cd apache\bin
D:\apache\bin> httpd -k install -n “ApacheServiceName”

Install MySQL as a service

Again this time go to MySQL bin directory

D:\>cd mysql\bin
D:\mysql\bin> mysqld –install

Now when you go to Administrative Tools-> Services you can see both the service are there you can right click on that and set properties->Startup type as automatic

To remove the services, type these commands

D:\>cd apache\bin
D:\apache\bin> httpd -k uninstall -n “ApacheServiceName”

D:\>cd mysql\bin
D:\mysql\bin> mysqld –remove