Archive: MySQL Service Problems


MySQL Service Problems
After trying all possible combinations I hope you guys can help me out with this frustrating problem.

When I try to register a service, it does not insert the service, or it inserts a faulty commandline.
The service-commandline must be as following (or must look like it):
"C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqld-nt" --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini" MySQL41


Here an example of one of the lines I tried(it were more strings, but they all give the same problem).
ExecWait `"$PROGRAMFILES\MySQL\MySQL Server 4.1\bin\mysqld" --install MySQL41 --defaults-file="$INSTDIR\logres.ini"`

This creates a service but with the wrong commandline (which causes it cannot be started). The commandline is like this:
"C:\Program Files\MySQL\MySQL Server 4.1\bin\mysqld" "--defaults-file=C:\Program Files\Logres\Promis Project\logres.ini" MySQL41


Can anybody help me out with a working solution ?
Thanks in advance.


I'm taking a wild guess at this. Perhaps quotations need to go around each parameter in its entirety.

ExecWait '"$PROGRAMFILES\MySQL\MySQL Server 4.1\bin\mysqld" "--install MySQL41" "--defaults-file=$INSTDIR\logres.ini"'
Or perhaps you could try reversing the order of the parameters.
ExecWait '"$PROGRAMFILES\MySQL\MySQL Server 4.1\bin\mysqld" "--defaults-file=$INSTDIR\logres.ini" "--install MySQL41"'

I've tried your suggestion but it just doing nothing. No service appeared in the serviceslist.

I cannot change the lineup of the commands because of its prefixed at that way. According to the MySQL Manual I have to execute this in a command prompt:
mysqld --install MySQL41 --defaults-file="C:\Program Files\MySQL\MySQL Server 4.1\my.ini"

When I copy/paste that into a command windows, it works when I use it in NSIS it's not working.

Are there any other people who succesfully added a mysql service to windows ?
Or if you have other suggestions.... :)

Thanks in advance


Try this:

ExpandEnvStrings $0 "%COMSPEC%"
nsExec::Exec '"$0" /C "$PROGRAMFILES\MySQL\MySQL Server 4.1\bin\mysqld" "--defaults-file=C:\Program Files\Logres\Promis Project\logres.ini"' MySQL41

Or some variation, but keeping the ExpandEnvStrings, and the nsExec::Exec "$0" /C bit.

have fun :)

[edited code slightly, missed a closing quotation mark]


Thanks for you reply, I tried your code. But it does not add anything to the registry/services list.
I made some changes to your code, in hope it would work, but it doesn't.

I tried the following code:
ExpandEnvStrings $0 "%COMSPEC%"
nsExec::Exec '"$0" /C "$PROGRAMFILES\MySQL\MySQL Server 4.1\bin\mysqld" --install MySQL41 --defaults-file=`"C:\Program Files\Logres\Promis Project\logres.ini"`'

According to the manual of MySQL first the executable must call itself, then the option "--install <servicename>" and then I need to feed it with a config file where the quotations must be within the program path. Like this:
--defaults-file="C:\Program Files\Logres\Promis Project\logres.ini"

I'm out off suggestions and ideas, anybody ?


Well, we solved the problem.
The solution was to use a different my.ini file. The first code I posted also worked after changing the .ini file.

So people if your MySQL service-installation fails to install, just use an other my.ini file.
The problem was not caused by NSIS in any way.


Keywords (for people who are seaching): MySQL, quotes, quotations, service, service-installation.