Check privileges of database user accounts before continuing with the setup

Implement owner and privilege checks for postgresql, and fix some errors in
existing MySQL privilege checks.

resolves #7389