Do you expect those words to be at the beginning of a line?
If the answer is no - there's your problem.
[edit]
That said: you're saying you want files that have BOTH.
You're looking for files that have either with the grep.
You'd either need two greps, or one very convoluted grep,
or you could use awk instead.... two greps w/ find may
be a tad ugly.
Code:
awk '/localhost/ && /DATABASE_NAME/'
[/edit]