I’d had some difficulty manually creating my own windows service for MariaDB (worked fine from the installer), but it was due to the way I was creating it, so I wanted to share the proper approach:
Old Way:
sc create "maria55" binpath= "\"C:/Program Files/MySQL/MariaDB 5.5/bin/mysqld\" \"--defaults-file=C:/Program Files/MySQL/MariaDB 5.5/data/my.ini\"" DisplayName= "Maria55" start= "auto"
New Way:
sc create "maria55" binpath= "\"C:/Program Files/MySQL/MariaDB 5.5/bin/mysqld\" \"--defaults-file=C:/Program Files/MySQL/MariaDB 5.5/data/my.ini\" maria55" DisplayName= "Maria55" start= "auto"
The key is adding the name, maria55, after the –defaults-file=.. option, but still within the “” that belong to “binpath”.
This extra parameter exists so that mysqld knows whether or not it was started as a service or not.
Without it, the server does not know, and therefore didn’t realize it was running as a service, and thus since the service manager got no response from mysqld, it terminated the service after 30 seconds (though I could connect and issue any MySQL command or query within that 30 seconds).
Many thanks to Wlad for helping me to track this down!
For reference, here is my terminal output:
C:\>sc create "maria55" binpath= "\"C:/Program Files/MySQL/MariaDB 5.5/bin/mysqld\" \"--defaults-file=C:/Program Files/MySQL/MariaDB 5.5/data/my.ini\" maria55" DisplayName= "Maria55" start= "auto" [SC] CreateService SUCCESS C:\Users\Chris>net start maria55 The maria55 service is starting. The maria55 service was started successfully.
With the initial service attempt, the service creates fine, but fails after 30 seconds:
C:\Users\Chris>net start maria55 The service is not responding to the control function. More help is available by typing NET HELPMSG 2186.
Hope this helps.
PlanetMySQL Voting: Vote UP / Vote DOWN