Create MariaDB Windows Service

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.

 

Tags: , , , , , , , , , ,

2 Responses to “Create MariaDB Windows Service”

  1. Wlad says:

    Hi Chris.

    *proper* and officially blessed approach is documented here:

    http://kb.askmonty.org/en/mysql_install_dbexe

    mysql_install_db.exe –datadir= –password=
    –service=

    Much easier, ist not it? Security is also taken care into account, for example
    (i.e unlike Oracle’s MySQL , MariaDB normaly does not run as LocalSystem, but as muc more limited NetworkServices account).

  2. Wlad says:

    Since previous entry lost some info dur to formatting, here an example again:

    mysql_install_db.exe –datadir=C:\data\dir –password=your_root_password
    –service=servicename


Period Panties by Period Panteez Menstrual Underwear Menstruation PMS Panty