Numerous times now, I’ve seen people have troubles creating MySQL services on Windows manually (using ’sc’), whether it be for mysqld itself, MySQL Proxy, or the MySQL Enterprise Monitor and/or Agent.
The proper syntax for ’sc’ can get tricky when you have spaces in pathnames, which is very common in Windows, and the need for –defaults-file (which means two paths each potentially containing spaces).
So, if you have spaces in both your binpath and your path to –defaults-file, then the following syntax will work for you (all on a single line):
sc create MySQLEnterpriseMonitorAgent binpath= "\"C:\Program Files\MySQL\Enterprise\Agent\bin\mysql-monitor-agent.exe\" --defaults-file=\"C:\Program Files\MySQL\Enterprise\Agent\etc\mysql-monitor-agent.ini\"" DisplayName= "MySQL Enterprise Monitor Agent" start= "auto"
Note that you could easily use the exact same syntax to install a Windows service for the MySQL server itself (using mysqld.exe and my.ini instead, along with their correct paths). Similarly, this could be also used to create a Windows service for MySQL Proxy too. Just point binpath to mysql-proxy-svc.exe, and instead of –defaults-file=, use –proxy-lua-script= (in fact, I actually had a post on this close to a year ago, but my example only had one path that contained a space, so the above syntax was not necessary).
At any rate, the above command should output somthing similar to the following:
[SC] CreateService SUCCESS
For reference, here is my terminal session:
C:\Users\Chris>sc create MySQLEnterpriseMonitorAgent binpath= "\"C:\Program Files\MySQL\Enterprise\Agent\bin\mysql-monitor-agent.exe\" --defaults-file=\"C:\Program Files\MySQL\Enterprise\Agent\etc\mysql-monitor-agent.ini\"" DisplayName= "MySQL Enterprise Monitor Agent" start= "auto" [SC] CreateService SUCCESS
Hope this helps.
PlanetMySQL Voting: Vote UP / Vote DOWN