Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PhP3 newbie has a question: What exactly is local host

Status
Not open for further replies.

kfickert

Programmer
Jan 10, 2000
12
0
0
US
Visit site
I've been trying to connect a php3 script to a MySQL on my web hosts server.&nbsp;&nbsp;I keep getting access denied for '216.150.65.170'.&nbsp;&nbsp;that is my site's ip address on the server, also the what I use to Telnet to the server or use <A HREF="ftp://FTP.&nbsp" TARGET="_new">FTP.&nbsp</A>;&nbsp;Is their some other IP address I'm supposed to be using<br><br>I'm using <br>mysql_connect ('216.150.65.170', 'elitesquadrons', 'mypassword')<br><br>
 
MySQL users are not the same as server account users, and whenever a user is added to MySQL, a host address is specified saying where that user may connect from. The default is 'localhost' meaning that the user is on the same machine as MySQL. This might seem funny, since you are obviously connecting from another location via the web, but PHP itself only runs locally and only receives requests directly from the webserver application. Your connection should probably look like mysql_connect ('localhost', 'elitesquadrons', 'mypassword')<br><br>This is not necessarily the case; it depends on how the sysadmins set up the server, but it is the most common configuration.
 
This previous response is absolutely true, and if that statement doesn't work, (I had problems before with it), just do the following
mysql_connect('127.0.0.1','elitesqadrons','mypassword')
This IP is basically a translation of localhost, so you don't have to go out on the network. Hope this helps :)


 
Might want to check with the hosting company to make sure the database and the web server are on the same system if not have them set up the user to connect from either your machine at home if you have a static ip and the web server's ip or just the web server's ip address
Chad
tinman@thelandofoz.org

Tinman,

Welcome to OZ.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top