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.

connecting remote databases from different websites

Discussion in 'PHP' started by beven, Jun 27, 2014.

  1. #1
    hi guys
    I have more than one websites and now i have to change the database of all websites. Database of the websites has same pattern means table name, column name. I want that i change one database and rest of all database will changed automatically.

    But i fail in establishing connection of database on one server. Please share with me your experience. Thanks in advance
    SEMrush
     
    beven, Jun 27, 2014 IP
    SEMrush
  2. sarahk

    sarahk iTamer Staff

    Messages:
    26,867
    Likes Received:
    4,092
    Best Answers:
    116
    Trophy Points:
    665
    #2
    Usually you refer to the database server as "localhost"
    If you want to point to another server you may need to get the server name from your hosting company and you may need to let them know that you are accessing it from sites on another server.

    If you are just accessing a different database on the same server you should just need to update the config/setting file with the new database name, username and password and they will seamlessly change over to the new datasource.
     
    sarahk, Jun 27, 2014 IP
  3. adrianTNT

    adrianTNT Well-Known Member

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    106
    #3
    If you have trouble reaching the database from another server, then it is possible that you need to allow the other server to connect, see the database settings, you might have a "hosts" list of IPs/domains that are allowed to connect to the database.
     
    adrianTNT, Jun 27, 2014 IP
  4. hip_hop_x

    hip_hop_x Active Member

    Messages:
    522
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #4
    I'm not sure if I got this right, so you want to change the tables inside one database and to affect every other database ? In this case it's more complicated, you will have to use sql and php to do those changes.
     
    hip_hop_x, Jun 27, 2014 IP