better mysql connection error handling