working version including mysql auth