The relationship is what machine is hosting the database (hence “hostname”) and once connected to that machine, the particular database you want to use (“database name”).
You can have more than one database hosted by the same machine, but the way DreamHost has their Web Panel set up, each database has to have its own hostname to access the machine it is on.
The database name is a MySQL identifier and according to the docs the acceptable characters are “Any character that is allowed in a directory name except
/',’ or `.’.” and up to 64 characters long.
Naturally a hostname follows different set of characters, for example you can’t have underscores. And it will be a subdomain of one of your domains.
Hostnames for the databases are just like hostnames for web sites. The MySQL client (PHP/phpBB) has to use DNS to get the IP address for “mysql.mydomain.com” then connects to that machine.
Once the client has connected, it logins in and says it wants to use the database called “database name”.