Fix error codes thrown by MySQL backend