The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 3 of 3

Thread: Connection Setting From Another Server

  1. #1

    Afrostyle Connection Setting From Another Server

    I want to establish connection in one of my website1 database, how can I establish connection to that database coming from my website2 hosted in different server.

    The following is my default connection settings in my website1, Im thinking of changing the localhost to something like www.website2.com but the following error is shown

    Access denied for user 'myusername'@'64.92.148.156' (using password: YES)

    <?
    $dbservername = "localhost";
    $dbusername = "myusername";
    $dbpassword = "mypassword";
    $defaultdb = "mydatabase";
    $cn = mysql_connect($dbservername,$dbusername,$dbpasswor d) or die("connection error ".mysql_error());
    $db = mysql_select_db($defaultdb);
    ?>

  2. #2
    602
    posts
    Backend Specialist
    Make sure when you create the user for website2 on website1's database you tell it to allow authentication from that IP address.

    To allow connections from certain IP:
    Code:
    grant all on database.* to 'user'@'64.92.148.156' identified by 'password'
    To allow connections from anywhere:
    Code:
    grant all on database.* to 'user'@'%' identified by 'password'
    Then always remember to flush it:
    Code:
    flush privileges

  3. #3
    I am using CPANEL, how can I do this in that environment?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012