What is wrong? the setup account unfortunately doesn't have any access to sharepoint content database under least privileges, but which account should be used then? A farm account certainly has all accesses to every sharepoint database, but again by least privilege rule, it is not supposed to be a local admin, otherwise you get warnings from Sharepoint Health Analyzer. Actually, the farm account, as a service account, might not even be given the right to log on locally. So what is the workaround? the answer to this dilemma: break the least privilege rule by giving setup account a SA server role in the database, and then re-run the configuration wizard to fix the problem.
By setup account, i mean the log on window account when running Sharepoint Wizard. During wizard configuration, this account is used to connect to sql and setup sql privilege of farm account, which in turn setup other service accounts in sql. The following infamous error occurring during wizard configuration is simply saying, the setup account needs to have sql privilege:
"Cannot connect to database master at SQL server at SERVER-SQL. The database might not exist, or the current user does not have permission to connect to it."