private bool CheckMySqlService() { if (HostCheck.IsLocalIpAddress(_host)) { Log.Info("Database host running at localhost."); Log.Info("Checking if MySQL Service is running at localhost..."); if (!HostCheck.ServiceExists(MysqlServiceName)) { Log.Error("MySQL Service does not exist at localhost Windows Services!"); return(false); } bool isMySqlServiceRunning = HostCheck.IsServiceRunning(MysqlServiceName); for (int i = 1; !isMySqlServiceRunning && (i <= MysqlServiceRetryAttempts); i++) { Log.Error("MySQL Service was not found running at localhost!"); Log.Warn($"Trying to start MySQL service...Retry attempt: {i}."); HostCheck.StartService(MysqlServiceName, MysqlServiceStartTimeoutMs); isMySqlServiceRunning = HostCheck.IsServiceRunning(MysqlServiceName); if (!isMySqlServiceRunning) { continue; } Log.Info("MySQL Service started!"); break; } if (isMySqlServiceRunning) { Log.Info("MySQL Service running at localhost."); } else { Log.Error("MySQL Service was not found running at localhost!"); } return(isMySqlServiceRunning); } Log.Info("Database host NOT running at localhost. MySQL Service check skipped."); return(true); }