Read `database` rather than `db` from my.cnf.

Also change argument name. But keep `db` for backward compatibility.