refactor mySQL + leader