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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connecting to outside MySQL Server

Status
Not open for further replies.

WelshTeckie

IS-IT--Management
Aug 9, 2007
37
GB
Hi I am trying to connect to a mysql database from another site not held on the same server.

I am using :-

$dblink = mysql_connect($dbHostname, $dbUsername, $dbPassword) OR DIE("Error !! Unable to connect to database");

But I am getting the error :-

Warning: mysql_connect(): Access denied for user: 'THEDATABASE@admin.planbecommunications.com' (Using password: YES) in /var/ on line 11
Error !! Unable to connect to database Can anyone please help. I have read up on it and people talk about allowing permissions,I am not sure that is possible on the godaddy server.

Any pointers would be great. Thanks...
 
you will need to use an account which has been set up on the remote server, and that account should have its "host" value set to either:
a) xxx.xxx.xxx.xxx //the IP you are connecting from
b) '%' // any address.

This account will need appropriate priviliges for select, insert, update etc.

A password is *highly* recommended, and a long one at that.

on the remote server then, you should
mysql> CREATE USER 'username'@'host' identified by password("verylongcomplexpassword");

mysql> GRANT [priviliges - ALL is favourite] on database.* to 'user'@'host';

mysql> FLUSH PRIVILEGES;


Once done, try connecting again :) - alternatively, change the "host" value in the mysql.mysql table for the user you are connecting with and then flush the privs.


______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top