MYSQL external access?

Discussion in 'MySQL' started by mtime88, Mar 14, 2008.

  1. #1
    Say I have a script on one hosting would it be possible to connect it to a database on another hosting? If so how would I do this?
     
    mtime88, Mar 14, 2008 IP
  2. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can if the other db server allows remote connections, you would simply replace the "localhost" to the address/ port of the db server in the connection string.

    Given that these types of connections are not encrypted and so you are broadcasting db login details openly across the net most db servers have remote connections turned off
     
    AstarothSolutions, Mar 14, 2008 IP
  3. mtime88

    mtime88 Peon

    Messages:
    690
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    so i would replace localhost with database locations ip:port#?
     
    mtime88, Mar 14, 2008 IP
  4. AstarothSolutions

    AstarothSolutions Peon

    Messages:
    2,680
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    0
    #4
    IP is ok but is subject to the host not changing it, most if they allow external connections will give you a url (eg slq.thedomain.com) to prevent this issue as they change the DNS servers and users dont change anything
     
    AstarothSolutions, Mar 14, 2008 IP
  5. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #5
    On the server you are connecting to, assuming that you also have control of it. You should only allow connections from hosts that you know. Your firewall should filter everything to port 3306 except from the hosts you want connecting to it. The last thing you want is for some script to try and brute force your database because it open to the outside.
     
    jestep, Mar 15, 2008 IP
  6. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #6
    most of the cpanel based hosts there is option to add IP of the site from which you want to access DB instead of only localhost


    Regards

    Alex
     
    kmap, Mar 15, 2008 IP
  7. turksweb

    turksweb Peon

    Messages:
    354
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    all depence. for example, godaddy standard shared hosting doesn't gives you connection from another hosting databases or vice varse. I have godaddy hosting and couldn't connect to another hosting databases. also I don't want to use godaddy for permanent, because very much restrictions.
     
    turksweb, Mar 16, 2008 IP
  8. hyper

    hyper Peon

    Messages:
    1,565
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Instead of the IP I recommend to use the domain name.
    Example:

    88.9.1.2 -> yourdomain.com

    Use it like this domain:port.
    On a major host, on the same ip could be hosted more than one website.

    Also, take a look at the host details. For example dreamhost has special mysql server for each domain... like:

    domain.com is your domain... and
    mysql.domain.com si the mysql server setting. In this case, yes, you can have external connections.

    Before you start anything, better ask the hosting support center. They can save your time.

    Thanks,
    hyper :)
     
    hyper, Jun 14, 2008 IP