Rework mysql backend by sils@sils.net