#### 23.3.2.4 Installing NDB Cluster Processes as Windows Services

 Once you are satisfied that NDB Cluster is running as desired, you can install the management nodes and data nodes as Windows services, so that these processes are started and stopped automatically whenever Windows is started or stopped. This also makes it possible to control these processes from the command line with the appropriate **SC START** and **SC STOP** commands, or using the Windows graphical **Services** utility. **NET START** and **NET STOP** commands can also be used.

 Installing programs as Windows services usually must be done using an account that has Administrator rights on the system.

 To install the management node as a service on Windows, invoke [**ndb\_mgmd.exe**](mysql-cluster-programs-ndb-mgmd.html) from the command line on the machine hosting the management node, using the [`--install`](mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_install) option, as shown here:

```
C:\> C:\mysql\bin\ndb_mgmd.exe --install
Installing service 'NDB Cluster Management Server'
  as '"C:\mysql\bin\ndbd.exe" "--service=ndb_mgmd"'
Service successfully installed.
```

Important

 When installing an NDB Cluster program as a Windows service, you should always specify the complete path; otherwise the service installation may fail with the error The system cannot find the file specified.

 The [`--install`](mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_install) option must be used first, ahead of any other options that might be specified for [**ndb\_mgmd.exe**](mysql-cluster-programs-ndb-mgmd.html). However, it is preferable to specify such options in an options file instead. If your options file is not in one of the default locations as shown in the output of [**ndb\_mgmd.exe**](mysql-cluster-programs-ndb-mgmd.html) [`--help`](mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_help), you can specify the location using the [`--config-file`](mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_config-file) option.

 Now you should be able to start and stop the management server like this:

```
C:\> SC START ndb_mgmd

C:\> SC STOP ndb_mgmd
```

Note

 If using **NET** commands, you can also start or stop the management server as a Windows service using the descriptive name, as shown here:

```
C:\> NET START 'NDB Cluster Management Server'
The NDB Cluster Management Server service is starting.
The NDB Cluster Management Server service was started successfully.

C:\> NET STOP  'NDB Cluster Management Server'
The NDB Cluster Management Server service is stopping..
The NDB Cluster Management Server service was stopped successfully.
```

 It is usually simpler to specify a short service name or to permit the default service name to be used when installing the service, and then reference that name when starting or stopping the service. To specify a service name other than `ndb_mgmd`, append it to the [`--install`](mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_install) option, as shown in this example:

```
C:\> C:\mysql\bin\ndb_mgmd.exe --install=mgmd1
Installing service 'NDB Cluster Management Server'
  as '"C:\mysql\bin\ndb_mgmd.exe" "--service=mgmd1"'
Service successfully installed.
```

 Now you should be able to start or stop the service using the name you have specified, like this:

```
C:\> SC START mgmd1

C:\> SC STOP mgmd1
```

 To remove the management node service, use **SC DELETE *`service_name`***:

```
C:\> SC DELETE mgmd1
```

 Alternatively, invoke [**ndb\_mgmd.exe**](mysql-cluster-programs-ndb-mgmd.html) with the [`--remove`](mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_remove) option, as shown here:

```
C:\> C:\mysql\bin\ndb_mgmd.exe --remove
Removing service 'NDB Cluster Management Server'
Service successfully removed.
```

 If you installed the service using a service name other than the default, pass the service name as the value of the [**ndb\_mgmd.exe**](mysql-cluster-programs-ndb-mgmd.html) [`--remove`](mysql-cluster-programs-ndb-mgmd.html#option_ndb_mgmd_remove) option, like this:

```
C:\> C:\mysql\bin\ndb_mgmd.exe --remove=mgmd1
Removing service 'mgmd1'
Service successfully removed.
```

 Installation of an NDB Cluster data node process as a Windows service can be done in a similar fashion, using the [`--install`](mysql-cluster-programs-ndbd.html#option_ndbd_install) option for [**ndbd.exe**](mysql-cluster-programs-ndbd.html) (or [**ndbmtd.exe**](mysql-cluster-programs-ndbmtd.html)), as shown here:

```
C:\> C:\mysql\bin\ndbd.exe --install
Installing service 'NDB Cluster Data Node Daemon' as '"C:\mysql\bin\ndbd.exe" "--service=ndbd"'
Service successfully installed.
```

 Now you can start or stop the data node as shown in the following example:

```
C:\> SC START ndbd

C:\> SC STOP ndbd
```

 To remove the data node service, use **SC DELETE *`service_name`***:

```
C:\> SC DELETE ndbd
```

 Alternatively, invoke [**ndbd.exe**](mysql-cluster-programs-ndbd.html) with the [`--remove`](mysql-cluster-programs-ndbd.html#option_ndbd_remove) option, as shown here:

```
C:\> C:\mysql\bin\ndbd.exe --remove
Removing service 'NDB Cluster Data Node Daemon'
Service successfully removed.
```

 As with [**ndb\_mgmd.exe**](mysql-cluster-programs-ndb-mgmd.html) (and [**mysqld.exe**](mysqld.html)), when installing [**ndbd.exe**](mysql-cluster-programs-ndbd.html) as a Windows service, you can also specify a name for the service as the value of [`--install`](mysql-cluster-programs-ndbd.html#option_ndbd_install), and then use it when starting or stopping the service, like this:

```
C:\> C:\mysql\bin\ndbd.exe --install=dnode1
Installing service 'dnode1' as '"C:\mysql\bin\ndbd.exe" "--service=dnode1"'
Service successfully installed.

C:\> SC START dnode1

C:\> SC STOP dnode1
```

 If you specified a service name when installing the data node service, you can use this name when removing it as well, as shown here:

```
C:\> SC DELETE dnode1
```

 Alternatively, you can pass the service name as the value of the `ndbd.exe` [`--remove`](mysql-cluster-programs-ndbd.html#option_ndbd_remove) option, as shown here:

```
C:\> C:\mysql\bin\ndbd.exe --remove=dnode1
Removing service 'dnode1'
Service successfully removed.
```

 Installation of the SQL node as a Windows service, starting the service, stopping the service, and removing the service are done in a similar fashion, using [**mysqld**](mysqld.html) `--install`, **SC START**, **SC STOP**, and **SC DELETE** (or [**mysqld**](mysqld.html) [`--remove`](server-options.html#option_mysqld_remove)). **NET** commands can also be used to start or stop a service. For additional information, see [Section 2.3.4.8, “Starting MySQL as a Windows Service”](windows-start-service.html).

