Database encryption is largely meaningless because of this problem. Point-of-sale systems sometimes require a human to enter an encryption key to unlock them when they start up, but nobody wants to do that on the web. You might have the webserver switch to an unprivileged user so it can't get the password again after it starts up. If an attacker breaks root on your server, there's really no way to stop them.
Schneier described a way to address the password-in-memory problem in his book Applied Cryptography. He called it a "boojum"... unfortunately, I can't seem to find a good explanation of it online.