How to access the database on another server?

Discussion in 'MySQL' started by sugarland, Jul 7, 2009.

  1. #1
    I setup the database on a dedicated server owned by myself, and I will build another website hosted by shared hosting. This website need to access and manage the database on the dedicated server, now how to do this?
     
    sugarland, Jul 7, 2009 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    You need to add a remote user to the database. If you have shell access, you would do this via a GRANT query.

    http://dev.mysql.com/doc/refman/5.0/en/grant.html

    You should limit access to the specific IP of the server accessing it. Do not do a * for the host. You may also have to open port 3306 if the server has a firewall. Again, only open it to the IP of the server accessing it, if possible.
     
    jestep, Jul 8, 2009 IP
  3. zahidraf

    zahidraf Well-Known Member

    Messages:
    450
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #3
    you can access via ip address as replied by jestep

    However you can access other server db using Soap :)
     
    zahidraf, Jul 12, 2009 IP
  4. HivelocityDD

    HivelocityDD Peon

    Messages:
    179
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    instead of using localhost in your code just give the ip of the dedicated server where you create the database along with the login details.

    Also make sure you allow the website IP to access the DB.
     
    HivelocityDD, Jul 13, 2009 IP