Creating a database for a new subdomain

wordpress

#1

I haven’t seen this question posted anywhere, so I’m pretty sure it’s an obvious answer.
Basically, I’m testing a new script on my website, and I want to make sure that it doesn’t mess anything up. Therefore, I’ve created a subdomain to try and load it on.
Problem is, I can’t figure out how to add a new database to the subdomain.
I created the subdomain fine, and it’s fully-hosted, but when I look for it in Goodies / Manage MySQL, it’s not listed as one of the hostdomains to add a database to. Is there something I have to do to get it listed on there, or should I just add the database to my regular domain?
Any help would be greatly appreciated.


#2

Hmm. That’s interesting. All my domains and subdomains are listed in that pull down list…

Though since there isn’t any hard and fast rule that your data server has to be a subdomain of the domain you’re hosting, it doesn’t matter. All your apps could point to the same data server name. Different names just help you keep track.

Free unique IP and $67 off with promo code [color=#CC0000]FLENSFREEIP67[/color] or use [color=#CC0000]FLENS97[/color] for $97 off. Click here for more options


#3

Thanks for the reply.
I’d prefer to put the database on the subdomain, just for peace of mind.
Anyone have any idea how to make it so my subdomain shows up on the Manage MySQL list?


#4

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. :wink:

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.

–rlparker


#5

Ha ha… I was typing while Lensman was typing, and he typed faster! :slight_smile: .

I think you will find the answer to your question in my response above. If that doesn’t help you get it sorted out, just post back, and we will try again. :wink:

–rlparker


#6

Well, for the second time today, you got your answer out “faster” while I was slowly typing! Ha ha ha :slight_smile:

I think that the OP might be confusing the “hostname” list (he wrote “it’s not listed as one of the hostdomains to add a database to”) as opposed to being in the pull-down list available when creating new hostnames, and I knocked out a response addressing that (though I admit I may well have misunderstood him completely!)

In which case, I probably either confused him hopelessly, or just blathered on pointlessly… again! :wink:

–rlparker


#7

rlparker, thanks so much for the detailed explanation. I’m still mildly confused about the whole thing, but I think the point is that it doesn’t really matter, since all the databases are on the same MySQL server anyways.
You were right, though. I was able to create a hostname called mysql.subdomain.domain.com…don’t know why I didn’t realize that before. Anyways, that’s basically the solution I was looking for, so I think I’m good. I’ll repost if I run into any more trouble.


#8

Good deal! You are welcome and I’m glad you were able to get it set up the way you want. I wouldn’t worry too much about not totally understanding it all - it can be be pretty confusing.

As long as you have managed to get it to do what you want, you should be good to go! :slight_smile:

–rlparker


#9

Ah yes, I had (incorrectly, I think) assumed that he was trying to create a new hostname.

Anyway, I’m glad everything worked out!

Free unique IP and $67 off with promo code [color=#CC0000]FLENSFREEIP67[/color] or use [color=#CC0000]FLENS97[/color] for $97 off. Click here for more options