[nycphp-talk] Connecting to MySQL on host questions
Keith J Richardson
Keith.Richardson at thompsonhealth.com
Wed Jan 14 08:12:10 EST 2004
If you need to run a mysql connection from a different machine than the localhost, you can add the ips and/or hostnames to the usernames to connect to mysql. You can say that user test/test can only connect from localhost, or from any host, or from your host, and then give them permissions that way. I have noticed that if you give access to some hosts, it maybe will say its connecting from another server, say the IP, the hostname, the hostname with a subdomain off of it, so to find out why you arent connecting, when you die() after the connect, use die(mysql_error()) - and it will display the proper error. I tried to connect from our intranet server to my win2k desktop that is running mysql, and mysql_error() puts out Access denied for user: 'root at 172.17.1.11' (Using password: YES) - so you know that you have to allow that user access from the host 172.17.1.11 - now if it was a machine with a FQDN, the domain name would probabally show up there.
-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Daniel Convissor
Sent: Wednesday, January 14, 2004 12:25 AM
To: NYPHP Talk
Subject: Re: [nycphp-talk] Connecting to MySQL on host questions
On Tue, Jan 13, 2004 at 11:56:38PM -0500, Bill Wolf wrote:
>
> The following code runs on my local machine but not on my host. On the host
> I'm not sure what value to use for the $site variable. Using the website or
> IP address isn't working.
Check $php_errormsg when doing mysql_connect() has problems.
Also, chances are $site needs to be 'localhost' rather than the domain
name.
Also, does the MySQL installation there have all the permissions lined up
for the host, user, password, database combination.
All of this information should be given to you by your ISP -- or you can
figure it out if you have access to the 'mysql' database which contains
all of the priveleges information.
I'm guessing you need to read up on the privileges system:
http://www.mysql.com/doc/en/Privilege_system.html
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409
_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk
More information about the talk
mailing list