Windows Services
GUI
Launch from Start menu or by typing this at a command/Powershell prompt...
services.msc
msconfig
Check
Powershell
Get-Service
Get-Service -ComputerName myServer
Get-Service -Name SQLSERVERAGENT -RequiredServices
Get-Service -Name MSSQLSERVER -DependentServices
Lists Name and Display Name of all Services and their current Status
As above for a specified Computer
Lists other Services that the named Service is dependent on
Lists other Services that depend on the named Service
Get-Service -Name *MySQL*
Get-Service -DisplayName *MySQL*
cmd
sc queryex | find "SERVICE_NAME" | find "MySQL"
sc queryex MySQLRouter
reg query HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\mysqlrouter
sc qc mysqlrouter
SERVICE_NAME: mysqlrouter TYPE : 10 WIN32_OWN_PROCESS START_TYPE : 2 AUTO_START ERROR_CONTROL : 1 NORMAL BINARY_PATH_NAME : "C:\Program Files\MySQL\MySQL Router 8.0\bin\mysqlrouter.exe" -c "C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf" --service LOAD_ORDER_GROUP : TAG : 0 DISPLAY_NAME : MySQL Router DEPENDENCIES : SERVICE_START_NAME : NT AUTHORITY\LocalService
Start/Stop/Restart a Service
This can be done via the GUI or...
Powershell
Start-Service -Name MSSQLSERVER
Restart-Service -Name MSSQLSERVER -Force
The -force flag is required because SQLSERVERAGENT is a dependent of MSSQLSERVERRestart-Service -Name SQLSERVERAGENT
Stop-Service -Name MSSQLSERVER
Stop-Service -Name *SQL*
Killing an unresponsive service
Find your service name... You can do this by clicking Properties in the Services GUI or by using something based on the examples below...
sc queryex | find "SERVICE_NAME" | find "SQL"
Get-Service -Name *SQL*
PowershellFind the PID of the service...
sc queryex MSSQLSERVER
KIll the Service...
taskkill /pid 999 /f