improve detecting run state for mysql