1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Just bought 1st server - Unknown MySQL server host error - how to fix?

Discussion in 'Site & Server Administration' started by dtang4, Oct 6, 2006.

  1. #1
    Hey all,
    So, I just bought my first server and am setting things up for the first time. Needless to say, I am a bit lost and would like to seek some advice.

    The issue I'm having now is this...

    When I try to connect to a mysql DB using the mysql_connect() php function by passing in www.mydomain.com as the host (NOT localhost), I receive the following error:
    Unknown MySQL server host 'www.mydomain.com'

    My host had originally said it was because DNS info was still propogating. However, it's been several days now and I'm still receiving the same problem.

    The reason I use www.mydomain.com at times and not localhost is because I often run scripts from my local machine on the remote DB. I also sometimes query things across domains.

    I am currently using WHM/CPanel. Any help would be greatly appreciated! Thanks.
     
    dtang4, Oct 6, 2006 IP
  2. doga

    doga Well-Known Member

    Messages:
    822
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    148
    #2
    You mean to say you are trying to connect database which is on another server as you are putting www.domian.com.
    Ping that domain and see if its resolving and if yes. Put the ip address instead of domain name. I think it will solve your problem
     
    doga, Oct 6, 2006 IP
  3. Mystique

    Mystique Well-Known Member

    Messages:
    2,579
    Likes Received:
    94
    Best Answers:
    2
    Trophy Points:
    195
    #3
    Why don't simply try localhost?

    Whether is your server or not, localhost is perfectly admissible :rolleyes:
     
    Mystique, Oct 6, 2006 IP
  4. tangtang

    tangtang Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, that is correct.

    So far, I've uploaded several domains to the server. If I ping the domains from the server, it resolves for some domains but doesn't resolve for others. However, whether or not it resolves, I still receive the connection error.
     
    tangtang, Oct 6, 2006 IP
  5. doga

    doga Well-Known Member

    Messages:
    822
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    148
    #5
    Yeah if his database is on same server then localhost will resolve the issue
     
    doga, Oct 6, 2006 IP