added safety that lets mysql server be disconnected