# Connection Setting From Another Server

**URL:** <https://forum.kirupa.com/t/connection-setting-from-another-server/249653>\
**Category:** programming\
**Created:** [January 21, 2008, 1:01pm UTC](https://forum.kirupa.com/t/connection-setting-from-another-server/249653 "2008-01-21T13:01:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![taurus5\_6](https://avatars.discourse-cdn.com/v4/letter/t/9d8465/32.png) [@taurus5\_6](https://forum.kirupa.com/u/taurus5_6)\
**Post date:** [January 21, 2008, 1:01pm UTC](https://forum.kirupa.com/t/connection-setting-from-another-server/249653/1 "2008-01-21T13:01:36Z")

</div>

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,$dbpassword) or die("connection error ".mysql\_error());  
$db = mysql\_select\_db($defaultdb);  
?\>:egg:
