Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm going to launch a website in a few days, and I'm thinking of having one front-end server, and one MySQL database server. And my question is, if I want to read/write to the MySQL server from the front-end server, how should I link to that server. Is it when I connect to the host in PHP I should use an IP instead of localhost? I'm pretty new to this so maybe this is a stupid question.

share|improve this question
up vote 1 down vote accepted

You just change the connection string from localhost to the IP, network name, or FQDN.

share|improve this answer
How would I get the ip of the second server? – John Doe Mar 25 '11 at 8:35
Lets say it like that: if you dont know it, then you have a problem. THis is like asking "where do I live?". You set up the servers, you know the IP you entered. Or your provider knows and you ask. – TomTom Mar 25 '11 at 9:29
I didn't buy the servers yet that's why I'm asking :P And it's the first website I do, so that's way I don't have much info about this stuff. – John Doe Mar 25 '11 at 10:26
If you install the machines yourself you'll have the IP. If you are using a hosting provider they will provide you with the private IPs of the machines which you use in the connection string. – mrdenny Mar 27 '11 at 5:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.