Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

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