Find the windows service name of MySql server instance
- Shoar
- 2011-12-15 00:19
- 4
The default name of windows service which holds MySQL server instance is 'MySQL'. But MySQL 5.5 allows user to specify any name for it after installation. Now I need to know the name of MySQL windows service but I can't understand where my application should look for this name. I was trying to specially make this name unusual and then find where MySQL stored it in the system. But this unusual name was only in the services list of windows registry. my.ini, my-huge.ini, and other ini files of MySQL server does not contain information about how it's windows service is named. So where MySQL stores this name? Windows version: 7 X86/X64, MySQL version: 5.5. Thanks in advance.
4 Answers
It's stored in the registry. The MySQL Instance Configuration Wizard reads the registry which contains the name and also the path to the corresponded service .exe.
But I don't exactly know how to find these registry entries programmatically.
PS: The entries may can be found here:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySQL[xy]
(xy is the version like: 57 for 5.7)
The ServiceName is stored here in the key "DisplayName" and the path to the .exe in "ImagePath".
Note: These path may contains start parameters like the path to the my.ini file also.
mysql service name linux, mysqld@.service (RPM platforms), mysql@.service (Debian platforms): Like mysqld.service or mysql.service, but used for managing multiple MySQL instances. mysqld.tmpfiles.d: File containing information to support the tmpfiles feature. This file is installed under the name mysql.conf. First make sure that mysql is installed on your server by below steps-. Step1: cat /etc/my.cnf. get data directory from here suppose it is /var/lib/
Paddy
2018-02-05 13:50
MySql variable @@pid_file contains path to the file contains proccess id of mysql instanse.
Read this value and map to the windows service.
In my c# code:
public static string GetServiceNameFromPid(uint pid) { string result = null; var searcher = new System.Management.ManagementObjectSearcher($"SELECT NAME FROM WIN32_SERVICE WHERE PROCESSID = {pid}"); foreach (var managementBaseObject in searcher.Get()){ if (result != null){ throw new InvalidOperationException("PID correspond two or above service name"); } result =(string) managementBaseObject["NAME"]; } return result; }
start mysql service windows, On Windows, the recommended way to run MySQL is to install it as a Windows service, so that MySQL starts and stops automatically when Windows starts and stops. A MySQL server installed as a service can also be controlled from the command line using NET commands, or with the graphical Services utility. (Sometimes found as MySQL56 or MySQL57 ) based on version installed.
Ivan Gusev
2018-05-28 11:08
MySQL does not need to store this name anywhere. The server process gets launched by Windows service controller, and the client communicates with the server via the network, so it does not need to know the name either. As you discovered, the only place this will appear is in the services list in the registry. Consider that on Linux, daemon processes don't have special names the way Windows services do. The service name is an artifact of running on Windows, and MySQL doesn't know or care about it.
mysql service not starting, MySQL Service will not start on Windows 10. Deborah Bauer. June 18, 2018 06:28PM Re: MySQL Service will not start on Windows 10. Peter Brawley. C:\> "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld" --install. The service-installation command does not start the server. Instructions for that are given
Jim Garrison
2011-12-15 01:31
New to MySQL, I ran into the same question. What I've done to workaround this is set the instance shared_memory_base_name to the same as the service name in the ini:
This make it available via the system variable @@shared_memory_base_name. I don't actually enable the shared-memory connections, just set the variable.
I haven't tried it on Linux, though maybe setting the @@socket system variable could provide the same.
I realize this is a bit late to help you now, but someone may find it useful...
Starting MySQL as a Windows Service, Find the windows service name of MySql server instance. The default name of windows service which holds MySQL server instance is 'MySQL'. But MySQL 5.5 allows user to specify any name for it after installation. You can specify a service name immediately following the --install option. the following rules determine the service name and option files that the server uses: After a MySQL server instance has been installed as a service, Windows starts
Rigo M
2013-11-20 03:41