How do you access a MySql database on a different site?

Discussion in 'MySQL' started by nate_king1, Jun 1, 2006.

  1. #1
    How do your access a different MySql database on a different IP on a different site?

    <?php
    # FileName="Connection_php_mysql.htm"
    # Type="MYSQL"
    # HTTP="true"
    $hostname_cityfacts = "XXX.XXX.XXX.XX"
    $database_cityfacts = "XXXXX_XXXX";
    $username_cityfacts = "XXXX_XXX";
    $password_cityfacts = "XXXXX";
    $cityfacts = mysql_pconnect($hostname_cityfacts, $username_cityfacts, $password_cityfacts) or trigger_error(mysql_error(),E_USER_ERROR);
    ?>

    It isn't owkring.
     
    nate_king1, Jun 1, 2006 IP
  2. TheHoff

    TheHoff Peon

    Messages:
    1,530
    Likes Received:
    130
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You have to be able to GRANT privileges to a new user on the database. Look up the GRANT command and you'll see how to specify that the user will be accessing over a remote port.
     
    TheHoff, Jun 1, 2006 IP
  3. Mong

    Mong ↓↘→ horsePower

    Messages:
    4,789
    Likes Received:
    734
    Best Answers:
    0
    Trophy Points:
    235
    #3
    Just change localhost to ipaddress:port in server variable value.
     
    Mong, Jun 1, 2006 IP
  4. nate_king1

    nate_king1 Active Member

    Messages:
    951
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    70
    #4
    How exactly do you do that,
     
    nate_king1, Jun 1, 2006 IP
  5. nate_king1

    nate_king1 Active Member

    Messages:
    951
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    70
    #5
    I have been trying that without the ":port" how do you know what port to use?
     
    nate_king1, Jun 1, 2006 IP
  6. Mong

    Mong ↓↘→ horsePower

    Messages:
    4,789
    Likes Received:
    734
    Best Answers:
    0
    Trophy Points:
    235
    #6
    Mostly 3306


    How to set previliges ?
    Goto cpanel and mysql databases
    Then scroll down and you will add host.
    then add %.%.%.%

    it means any ip can access mysql databases.
     
    Mong, Jun 1, 2006 IP
    nate_king1 likes this.
  7. nate_king1

    nate_king1 Active Member

    Messages:
    951
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    70
    #7
    nate_king1, Jun 1, 2006 IP
  8. nate_king1

    nate_king1 Active Member

    Messages:
    951
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    70
    #8
    Omg i got it to work. Thanks so much.
     
    nate_king1, Jun 1, 2006 IP
  9. Mong

    Mong ↓↘→ horsePower

    Messages:
    4,789
    Likes Received:
    734
    Best Answers:
    0
    Trophy Points:
    235
    #9
    What was you missing :p
     
    Mong, Jun 2, 2006 IP
  10. ForgottenCreature

    ForgottenCreature Notable Member

    Messages:
    7,473
    Likes Received:
    173
    Best Answers:
    0
    Trophy Points:
    260
    #10
    How did you fix it? :)
     
    ForgottenCreature, Jun 2, 2006 IP
  11. nate_king1

    nate_king1 Active Member

    Messages:
    951
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    70
    #11
    I fixed it by allowing the database to access the IP. Simple mistake.
     
    nate_king1, Jun 6, 2006 IP