Hostnames and domain names: their relationship?


#1

I’m trying to undetstand the relationship (structural and operational) between MySQL Hostnames and domain names. I’m hoping someone can shine some light.

For context, I host several domains on my account. On the “Manage MySQL” page, I’m presented with an outline of my MySQL resources. On my page are two MySQL Severs – each with a two part name in the format partone:parttwo. I’m assuming that these are just the names of the physical servers on which my databases reside.

Each of these server names has below it an area for Hostnames. One of the servers lists only one Hostname, and the second one lists three. Most of these Hostnames are named in the format mysql.domainname.com, for the different domains I associate their use with.

At the top of the Hostname section that lists three Hostnames, it says that the three Hostnames “are interchangeable.” When I look at these using phpMyAdmin, they do in fact seem identical, each containing the same databases and tables.

So some questions:

  1. If these Hostnames are interchangeable, what reasons might I have for creating a new one when I create a new database? Being interchangeable, the new db shows up in all of the other Hostnames on that server anyway. So what am I gaining, other than a name association between the Hostname and the database? I like that. But is that it?

  2. When I create a new Hostname and select (from the dropdown box) one of my domains for its name – e.g., mysql.domainname.com – what is its actual relationship to that domain? The databases themselves are listed as being “on this server,” yet they appear to be structurally “under” the Hostaname – and all the databases on that server are fully accessible from any one of the interchangeable Hostnames. So again, what exactly does the Hostname do?

  3. How did I end up on two different servers? Is it possible to move the database that is under the single Hostname on the first server, to the second server, so they are all grouped together (if onyl for organizational reasons)?

  4. Is it possible to make the Hostnames not “interchangeable.” Maybe I’m missing something, but it seems that would be more useful, from the pov of organizing projects and associating them by name. Instead, it just seems to be one big pool of databases, and a bunch of Hostnames that differ only in their names.

  5. Is there more to this than just a potentially VERY cluttered interface with redundant options?

This all seems more confusing than it should be. But I’m unable to find a clear and simple and to the point explanation of the relationship between these different elements. It’s not that I’m unable to get things working, usually, but it would be nice to have a better understanding of what the options I’m being presented with mean.

All insight appreciated.


#2

From what I understand, you can take hostname as server name of the MySQL databases.

For example, you can have a database server in DH like mysql1.yourdomain.com, or mysql2.yourdomain.com. You can also have another database server in another place like mysql.anotherdomain.com. Since DH gives us unlimited subdomains, you can have unlimited MySQL hostnames.

  • You can have multiple databases with one hostname (or one MySQL database server).
  • You can have multiple tables in one database
  • One hostname (or one MySQL database server) may have more than one MySQL users. These user can access only the databases created in the same hostname.
  • If you want to restrict the access to database among different users, you can create multiple hostnames and grant access to different groups of database users.

Hope this helps a bit.

Save $50 (MAX Discount) with code: [color=#CC0000]50YES[/color] Sign Up NOW or More Codes Here


#3

Hmm. I only have one server (also with a two part name).

Regarding the two-part name, I’ve noticed that there are two servers (or at least two server names) connected with each MySQL: partone.dreamhost.com and parttwo.partone.dreamhost.com. It is the latter that is the host to which each of your mysql.yourdomain.tld resolves.

I haven’t figured out any more than this. Anyone with additional insight should feel free to chime in.

This is purely a matter of convenience and convention. All client programs will need a hostname to connect to so you should think about naming them in relation to the domains on which their apps are running or serving. That way, your application is a bit more portable to different web hosts or accounts.

Alternatively, you can just use one name for all your domains. This has an obvious simplicity to it but may require that the name may not make that much sense in relation to the domain your application is running on.

I don’t see that the databases are structurally “under” the hostname. It seems to me that the databases are independent of the hostnames. Again, the hostname is required by your client programs to access your database. They will always have access to all your databases (given that the username they are using has access to that database).

I dunno. It’s certainly a big mystery to me as I’m only on one server.

I don’t think this is really possible, as there is only one actual server you are dealing with with one namespace for databases and users. The hostnames are merely a convenience for you to abstract you from the dreamhost-assigned server name.

Your situation is clouded by the fact that you’re on two different servers. I don’t think this is usual and I’d ask support about it. Do you by any chance have multiple accounts? Or multiple panel users?

At first, I just used one single hostname. This eliminated any confusion for me and I was just happy with this situation as I just used that one hostname for all my database and all my domain applications. And then I decided to drop the domain that was the parent domain for that hostname and had to change all my web applications to use a different hostname.

extra domains and the new maximum $50 off with codes [color=#CC0000]1DOM50, 2DOM50 and 3DOM50[/color]. More Dreamhost coupons


#4

Lensman and patricktan,

Thank you very much for your replies. Though there is still some mystery to it all, I think I have a better understanding of the relationships between these different elements. I believe I was looking for more significance to the Hostname that isn’t actually there. And as Lensman said, my confusion has been aided by by my being on two different servers. I will write to support about that.

Thanks again.


#5

Hey, anytime. Do let us know what support says, as your situation of having two different actual mysql servers is unusual.

Also, feel free to ask further questions when you’re ready!

extra domains and the new maximum $50 off with codes [color=#CC0000]1DOM50, 2DOM50 and 3DOM50[/color]. More Dreamhost coupons


#6

There was a time not long ago that when a DB was created it was assigned to “an available server” rather than one earmarked as “your server”. At one point I had four different mysql servers that I was pointing to. I just backed up my stuff, created a new DB instance and gave it the same “domain name” as my old server and restored the data. It now seems to use the same server as the other databases.

(Of course, “Your server” is relative, everything’s shared)

Wholly - Use promo code WhollyMindless for discount.


#7

Yeah … I have not been as "industrious’ as you and “migrated” my myriad databases onto a single server . I have them scattered over several severs. :wink:

–rlparker


#8

It was an advantage only having three.

Wholly - Use promo code WhollyMindless for discount.