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

I'd definitely like another eye on this