That whole process can be pretty confusing the way the Control Panel Screen for adding databases and hostnames is set up. I think what is confusing you is the whole concept of hostnames vs servers.
In the panel, unless you have been here quite a while, all of your database are created on a single database server (older accounts may be structured differently, with multiple servers in use). This server name is the first piece of "Header information" provided on the Control Panel -> Goodies -> Manage MySQL screen, and is in the form of "something:somethingelse" - MySQL Server". You cannot change this; it is only there for information purposes so you know what server your databases (and hostnames) are stored on.
Under that MySQL Server header information you will find the MySQL hostnames (aliases that refer to the server and provide connection information to your databases). If you have already created some databases (as you indicate you have), some of your "domains" will be listed here with the appropriate subdomain names assigned for the MySQL host instance your databases are assigned to. Note that these are all just alias names for the same server - they are completely interchangeable.
For instance, "mysql.yourdoman.com" and "myotherapplicationsdata.yourdomain.com" point to the same place, and you can/could use either one to connect to a database you have created.
This is where it gets confusing, because many people (myself included) like to keep a "hostname" that is related to the domain/application I am using a database for (Joomla!, WordPress, etc.) - and I can do that if I want, but I do not have to - all these databases can use a single hostname just fine. It just makes it harder for me to manage when I use PhpMyAdmin to "browse" that host and find many databases there to choose from.
For this reason, you can create a new "hostname" for each database or application (and/or each domain or sub-domain) if you want - it might make it easier for you to keep things sorted and present a "cleaner" (less cluttered screen) for PhpMyAdmin.
All that said, and once you understand all of that, you can probably understand why you may not see a given domain available in that existing list of "hostnames" - if a host has never been created using a given domain , or sub-domain (which seems to be your case), there will not a choice in that list for you to choose from that reflects that domain or sub-domain.
You can add a new hostname for use with any domain or sub-domain you control in one of two different ways.
1) You can select the "Add a new Hostname" link, and then select the domain or sub-domain (in the case you described, the sub-domain you just created for the purpose of your testing your new script) from the pull-down list that is presented. If your new sub-domain is completely set-up, and that can take a bit or time, it will be available in this list. You may name the new host "mysql.sub-domain.domain.tld" or testingdat.su-domain.domain.tld" or any other valid name that makes sense for you.
2) Additionally (or alternately) you can also create a new hostname directly from the "Create a new MySQL Database" link at the bottom of the Manage MySQL screen. If you choose this route, just make sure the "Use Hostname" pull-down selection box is set to "create a new hostname now", put the first part of the new hostname in the text box adjacent to "New Hostname", and use the pull downbox next to that to set the domain/sub domain to use for the hostname. Again, this pulldown box will contain all completely set up domains and sub-domains on your account.
One thing to consider is that, if you have just recently added a sub-domain, it may take a while to show up in the list - somethings are "updated" in the DreamHost system in "batches" and this new sub-domain may not show up in the list immediately. It may, or may not, have anything to do with the propagation of DNS for that subdomain - I don't know exactly how/when/where the DreamHost backend takes the data to create that "list" of available domains/sub-domains. If it is not there, and you just recently created it, wait for a few hours and try again - all my sub-domains, or all my domains, are listed there.
Once you have completed setting up the hostname and creating the new database (using either method described above for the hostname), you should be good to go once it is all"live".
Remember that if you choose to setup a new "hostname" it will take some time (usually an hour or so, but could be quicker or slower) for that new hostname to be available via DNS (which it must be for you to browse directly to it via PhpMyAdmin or use it in a connection for an application.)
Of course, if you don't want to wait for the new "hostname subdomain (it, too, is a sub-domain!) to "propagate", you can just use an existing hostname, and use that hostname when connecting via your application or PhpMyAdmin. It really ios only a matter of personal choice, and how you want to keep things organized.
You might consider that if, God forbid, your "testing" application should somehow break in any way that could expose your MySQL hostname, maybe even in an error message, you probably do not the existence of one of your other domain's to be exposed (especially true when hosting multiple domains as opposed to just sub-domains). I wouldn't want any error message or compromised application running at something.clientA.com to result in clientB.com's MySQL hostname to be exposed.
It may not actually cause any real harm, but I think it looks unprofessional and prefer to keep hostnames for applications running on clientA.com set to something.clientA.com.