I'm sorry, but if you can access the MySQL database from the control panel via PhpMyAdmin, have the previously described proper Dreamhost for the database user, and have your applications providing the correct hostname, user, pass, and database name for the database but still can't connect I have no other clues, and suggest you contact support.
Note that if you are tryng to connect to a Dreamhost hosted database (and host) from another site, or domain name that is not part of Dreamhost, you need to enable the user to connect to the database from that host (whether it be your own computer, or the host of the other website.)
Generally, this stuff either works properly, or doesn't work at all. The fact that you can reach the database via PhpMyAdmin makes me suspect you have something misconfigured, but without specific details I can only guess what that might be. Maybe DH Support (who can access your files/dirs) can do a better job of telling what is wrong.