Make the imapsync script connect to mysql via socket and not tcp like all other services do. Reasoning: consistency. 🤓 And in my case the database does not listen on tcp; just on the socket.