bug #4252 Database-level permission bug for db names containing underscores

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Fix merge conflict

Signed-off-by: Marc Delisle <marc@infomarc.info>