Bug #119841 MySQL Router 8.4.8 cannot start as Windows service
Submitted: 3 Feb 9:05 Modified: 26 Feb 1:21
Reporter: huang yiheng Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Router Severity:S2 (Serious)
Version:8.4.8 OS:Windows (Server2016 Version1607)
Assigned to: CPU Architecture:x86

[3 Feb 9:05] huang yiheng
Description:
No issues with MySQL Router 8.0.44 on these machines. 

Upgraded to 8.4.8 and since then the MySQL Router service cannot start. 
>>>Error message: The MySQLRouter service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services and programs.

Downgraded to 8.4.7 will start normally.

P.S. MySQL Router 8.4.8 can start normally if manually started.

How to repeat:
1. unzip mysql-router-8.4.8-winx64.zip to C:\Program Files\MySQL\MySQL Router 8.4

2. "C:\Program Files\MySQL\MySQL Router 8.4\mysqlrouter.exe" --bootstrap icadmin@XXX:16446 --conf-base-port 16446 --force

3. copy mysqlrouter.conf to C:\ProgramData\MySQL\MySQL Router\

4. "C:\Program Files\MySQL\MySQL Router 8.4\mysqlrouter.exe" -c "C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf"
^^^start normally

5. "C:\Program Files\MySQL\MySQL Router 8.4\mysqlrouter.exe" --install-service MySQLRouter -c C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf"
^^^complete normally

6. sc start MySQLRouter
^^^raise error
[25 Feb 10:44] MySQL Verification Team
For step 5 did you mean to write this instead ?

5. "C:\Program Files\MySQL\MySQL Router 8.4\mysqlrouter.exe" --install-service MySQLRouter -c "C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf"
[26 Feb 1:01] huang yiheng
Thanks for adding, the actual content is as follows:

5. "C:\Program Files\MySQL\MySQL Router 8.4\mysqlrouter.exe" --install-service MySQLRouter -c "C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf"
[26 Feb 1:21] huang yiheng
The following is additional detailed information[How to repeat]:

1. The mysqlrouter 8.0.44 was installed on C:\Program Files\MySQL\MySQL Router 8.0
- The previous mysqlrouter.conf is located in C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf
- The previous Windows service is MySQLRouter80

2. unzip mysql-router-8.4.8-winx64.zip to C:\Program Files\MySQL\MySQL Router 8.4

3. "C:\Program Files\MySQL\MySQL Router 8.4\mysqlrouter.exe" --bootstrap icadmin@XXX:16446 --conf-base-port 16446 --force

4. rename C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf to C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf.bak

5. copy mysqlrouter.conf to C:\ProgramData\MySQL\MySQL Router\

6. "C:\Program Files\MySQL\MySQL Router 8.4\mysqlrouter.exe" -c "C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf"
^^^Manual startup success

7. "C:\Program Files\MySQL\MySQL Router 8.4\mysqlrouter.exe" --install-service MySQLRouter -c "C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf"
^^^Create service success

8. Start MySQLRouter in service.msc using default mysqlrouter.conf(generated by bootstrap)
^^^success

9. Modify C:\ProgramData\MySQL\MySQL Router\mysqlrouter.conf, for example, I added max_total_connections=5000 and max_comnect_rorrs=999999

10. Start MySQLRouter in service.msc
^^^Raise error: The MySQLRouter service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services and programs.
[26 Feb 18:06] MySQL Verification Team
I was able to repeat this behavior. Window's Event Viewer indicated it was a permissions problem. Fixing the ACLs allowed the service to start:

icacls "c:\ProgramData\MySQL\MySQL Router" /grant "NT AUTHORITY\LOCAL SERVICE":(OI)(CI)(F) /T