Handle mysql error on Linux and Mac