MySQL auto-reconnect and checking