Install MySQL as a Service

First make sure MySQL is not running (with for example the command: C:\mysql\bin\mysqladmin -u root -ppassword shutdown).

Install mysqld server with the default service name MySQL: c:\mysql\bin\mysqld --install

As of 4.0.2, you can also add a service name, like: c:\mysql\bin\mysqld --install MySQL4026

As of MySQL 4.0.3, if a service name is given, you can also specific the location of the option file with:
c:\mysql\bin\mysqld --install MySQL4026--defaults-file=c:\mysql\my.ini

Note: By default, this service is set to start automatically for a service set to "manual" use the option:  --install-manual.


Note concerning the option file:
If the service, installation command, specifies a service name other than the default (MySQL), the server reads options from the group that has the same name as the service, and reads options from the standard option files.
As of MySQL 4.0.17, the server also reads options from the default group, [mysqld], from the standard option files. This allows you to use the [mysqld] group for options that should be used by all MySQL services, and an option group with the same name as a service for use by the server installed with that service name. If the installation command specifies a --defaults-file option after the service name, the server reads options only from the [mysqld] group of the named file and ignores the standard option files.

The error log is located in the MySQL data directory (for example, c:\mysql\data). It is the file with the suffix of .err.


To remove the service, use: c:\mysql\bin\mysqld --remove
or with a service name other then the default: c:\mysql\bin\mysqld --remove MySQL4026


You can manually tweak the MySQL Service using "regedit" at: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySQL or HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\YourCustomNamedMySQLInstance

To change the executable or the parameters simply edit the string value ImagePath.
To pick different MySQL server see: Selecting a MySQL Server type


Now that we have learned how to do this the hard way, here is the easy way using MySQL Administrator.
MySQL Administrator offers "MySQL Instance Manager". This free tool offered by MySQL AB can be accessed in 2 ways:

1) Start "MySQL Administrator" at the login screen press the "Ctrl" key, the "Cancel" button becomes "Skip".

MySQL Administrator

Click the "Skip" button to start the "MySQL Instance Manager":

MySQL Instance Manager


2) Right mouse click the "MySQL System Tray Monitor" icon and select the menu item: "Actions-->Manage MySQL Instances":

MySQL System Tray Monitor