content_image/721170.jpg
group from the standard option files. However, because the --defaults-file  option is present, the server reads options from the [mysqld]  option group, and only from the named file. 

<img src='content_image/721170.jpg'>

## Note 

On Windows, if the server is started with the --defaults-file  and --install options, --install  must be first. Otherwise, mysqld.exe  attempts to start the MySQL server. 

You can also specify options as Start parameters in the Windows Services  utility before you start the MySQL service. 

Finally, before trying to start the MySQL service, make sure the user variables %TEMP%  and %TMP% (and also %TMPDIR% , if it has ever been set) for the operating system user who is to run the service are pointing to a folder to which the user has write access. The default user for running the MySQL service is LocalSystem , and the default value for its %TEMP%  and %TMP%  is C:\Windows\Temp , a directory LocalSystem  has write access to by default. However, if there are any changes to that default setup (for example, changes to the user who runs the service or to the mentioned user variables, or the --tmpdir option has been used to put the temporary directory somewhere else), the MySQL service might fail to run because write access to the temporary directory has not been granted to the proper user. 

## Starting the service 

After a MySQL server instance has been installed as a service, Windows starts the service automatically whenever Windows starts. The service also can be started immediately from the Services  utility, or by using an sc start mysqld_service_name  or NET START mysqld_service_name  command. SC and NET  commands are not case-sensitive. 

When run as a service, mysqld  has no access to a console window, so no messages can be seen there. If mysqld  does not start, check the error log to see whether the server wrote any messages there to indicate the cause of the problem. The error log is located in the MySQL data directory (for example, C:\Program Files\MySQL\MySQL Server 8.0\data ). It is the file with a suffix of .err . 

When a MySQL server has been installed as a service, and the service is running, Windows stops the service automatically when Windows shuts down. The server also can be stopped manually using the Services  utility, the sc stop mysqld_service_name  command, the NET STOP mysqld_service_name  command, or the mysqladmin shutdown  command. 

You also have the choice of installing the server as a manual service if you do not wish for the service to be started automatically during the boot process. To do this, use the --install-manual  option rather than the --install  option: 

## Removing the service 

C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --install-manual 

To remove a server that is installed as a service, first stop it if it is running by executing SC STOP mysqld_service_name  or NET STOP mysqld_service_name . Then use SC DELETE mysqld_service_name  to remove it: 

C:\> SC DELETE mysql 

Alternatively, use the mysqld --remove  option to remove the service. 

C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --remove 

If mysqld  is not running as a service, you can start it from the command line. For instructions, see Section 2.3.4.6, “Starting MySQL from the Windows Command Line” . 

