Connecting to a remote database !!

Discussion in 'PHP' started by faisal_bs74, Jan 13, 2009.

  1. #1
    Hi everyone.

    I m working on the project "Online Database Server" something like phpmyadmin,
    I want to provide a web service in php i.e anyone can connect his/her desktop application to my online database how can it will be achieved in php.

    thanks for the help in advance..
     
    faisal_bs74, Jan 13, 2009 IP
  2. rjd22

    rjd22 Peon

    Messages:
    63
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    in place of localhost put your IP on the serverspot

    
    // we connect to example.com and port 3307
    $link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');
    if (!$link) {
        die('Could not connect: ' . mysql_error());
    }
    echo 'Connected successfully';
    mysql_close($link);
    
    PHP:
    Where example.com your domain is or your IP from your server
     
    rjd22, Jan 14, 2009 IP
  3. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #3
    Most things will be the same as when you are connecting locally with 2 exceptions:
    1. You'll have to set your firewall to allow inbound connections to the MySQL port.
    2. You'll need to create a MySQL user (and password) that can connect from any host. You do this with the 'GRANT' command. More info here: http://dev.mysql.com/doc/refman/5.1/en/grant.html
     
    phper, Jan 14, 2009 IP
  4. SEOpaw

    SEOpaw Peon

    Messages:
    437
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You need to add your IP which you will do the remote to the Remote Database list
     
    SEOpaw, Jan 14, 2009 IP
  5. faisal_bs74

    faisal_bs74 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Ya u all got my point thanks for the info but i m not professional plz give me the links of tutorials and some useful places from where i could learn these type of professional services ....

    I want that anyone make their app say in dot net framework (front end) and for the database purpose he/she use my online database server login into that and create database tables and then every time from front end enter th info and will be connected to online database tables databases are shown just like localhost,........

    I think it will be clear hopefully ....

    thanks in advance..
     
    faisal_bs74, Jan 14, 2009 IP