Can i access MySQL from different host

Discussion in 'Programming' started by app789, May 2, 2009.

  1. #1
    My hosting company is not allowing me to use their MySQL database, I want to start wordpress blog, my other hosting company allows me both, is it possible to keep php files at one host and MySQL at other host.
    Hope I explained in worst way.
     
    app789, May 2, 2009 IP
  2. creativeGenius

    creativeGenius Well-Known Member

    Messages:
    273
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    120
    #2
    yep, most definitely possible, you can easily set this in your cpanel (if you have one) using the "Remote Databases" interface
     
    creativeGenius, May 3, 2009 IP
  3. hiteklife

    hiteklife Greenhorn

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #3
    This can happen sometimes, and all you have to do is edit the wp-config.php file to change the host address.

    You'll find a section that looks like this:
    The part in bold is the part you want to change. You are in that 1% chance it's talking about, lol. You will have to create a remote database for wordpress to use on the other hosting account. Once created, you should be able to get the address to put in there. Once you have that saved with your relevant login information, your wordpress blog will be pulling and saving information to your remote MYSQL server. Does that help?
     
    hiteklife, May 3, 2009 IP
  4. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #4
    Yes you can do that. 2 simple steps.

    Login to Cpanel on the server that has Mysql and go to "Remote Mysql".
    In the "Add Access Host" add the server IP (or hostname) of the server that does not allow you mysql & that has the php script files.

    In your script config (database config).. specify the server that has MySQL. Use the servers IP or hostname. Using the IP is best.

    Your script will connect to the remote Mysql and use the database that you have their.

    Hope it helps :cool:
     
    Talker, May 3, 2009 IP
  5. oburlaca

    oburlaca Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Some thoughts on using a database from another host:
    If the two hosts are "near" each other, in terms on network distance (for ex. both servers are located at the same ISP), then it's a good architecture. Your site will be able to handle more requests because database operations will be performed on another host.
    But if those two servers are scattered across the globe then ... it will take time to fetch the data from the DB.
    Also notice the time needed to establish a connection to the database on the remote host.
    Hopefully, MySql is quick regarding this issue compared to Oracle for example.
     
    oburlaca, May 4, 2009 IP
  6. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #6

    Good thought, however data centers have very high bandwidth and mostly all servers are US based.
    The carriers in the US make is easy for servers at different data centers to communicate with each other at very high bandwidth channels.
    It wont make so much of a difference if the site does not have extreme traffic and both the servers are in the US.
     
    Talker, May 4, 2009 IP
  7. oburlaca

    oburlaca Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Yep, agree ... I'm thinking more about busy websites than simple ones ;)
    But from another perspective ... you can have serveral websites running on servers without a MySql server that all use one DBServer for storage. It will ease the db administration (backup for ex).

    In the end: having a separate server for DB is a good thing :)
     
    oburlaca, May 4, 2009 IP
  8. Talker

    Talker Notable Member

    Messages:
    2,795
    Likes Received:
    108
    Best Answers:
    0
    Trophy Points:
    210
    #8
    Thats right. Most big hosts have server clusters and they use the same typology. Each of the services run on a separate server like WWW, Email, MySQL etc. But happens in case they have a rack at the data center and all servers are mounted on the same rack.

    You cant host a DB server on an offshore location without having the right network. But for a simple cause like the OP has mentioned (for a single site), its not a problem.
     
    Talker, May 4, 2009 IP
  9. ChiliPalmer

    ChiliPalmer Greenhorn

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #9
    Thank you, I was just looking for a solution like this one.
     
    ChiliPalmer, May 4, 2009 IP
  10. hiteklife

    hiteklife Greenhorn

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #10
    :) Glad I could help
     
    hiteklife, May 10, 2009 IP
  11. rahulkucheria

    rahulkucheria Well-Known Member

    Messages:
    161
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #11
    yes if ur hosting allows u to do it
     
    rahulkucheria, May 10, 2009 IP
  12. monster64

    monster64 Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Don't forgot to allow the proper port, most likely 3306, to outside traffic if you have a firewall installed.
     
    monster64, May 11, 2009 IP
  13. gummyworms

    gummyworms Active Member

    Messages:
    126
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #13
    the reason hosts give when they deny you is usually something like for security, never really tell you what security, just that it's for security. Then you think to yourself if a bunch spammers can dump data into my database with some tweak, is there really any security at all. The real reason is because these hosts want to keep you tight and obedient under their supervision. everything you do they want to have control over.
     
    gummyworms, May 12, 2009 IP
  14. monster64

    monster64 Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    If you do get another host, make sure the two datacenters are physically close to each other. The more the packets have to be redirected the slower each query will be. If possible, try to find another host that allows MySQL dbs in that same datacenter that your current host in situated in. That way you minimize potential downtime because the packets would travel within the same network.
     
    monster64, May 12, 2009 IP
  15. allrok

    allrok Greenhorn

    Messages:
    54
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #15
    That's i am searching from long time. thanks all for your valuable information, specially to oburlaca.
     
    allrok, May 18, 2009 IP