Better mysql master detection