Refactor mysqlprovider