Jump to content

Recommended Posts

Is there a setting somewhere that could prevent connection to a database from a different server?

 

I am trying to connect to DB1 setup at Server1 from a site hosted at Server2.

 

The code works fine from Server1 to DB1 but not from Server2 to DB1.

 

I hope this question makes sense.  Let me know if you need clarification to help

 

I use the exact same code for both.

 

$con = mysql_connect("thehost","Stinks","Pretty");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("Stinks", $con);

 

-Anthony

Link to comment
https://forums.phpfreaks.com/topic/98977-cant-connect/
Share on other sites

im sure there are numerous thories as to why this wouldnt work, like firewalls etc on server 2.

 

are you using a hostname or an ip-address as the host?

 

some webservers restrict usernames to a specific host, sometimes "localhost" to prevent outside communication.

-------

 

what error does mysql give? cannot connect to server at local port?

or mysql username/pass invalid?

 

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/98977-cant-connect/#findComment-506470
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.