Catch exception in case mysql is already stopped