[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [cobalt-users] OT: MySQL



-----Original Message-----
From: cobalt-users-admin@xxxxxxxxxxxxxxx
[mailto:cobalt-users-admin@xxxxxxxxxxxxxxx]On Behalf Of Andy Jacobs
Sent: Friday, June 22, 2001 8:56 AM
To: cobalt-users@xxxxxxxxxxxxxxx
Subject: [cobalt-users] OT: MySQL

Hi all,

I have just started playing with MySQL on a RAQ4.

It all works fine when I telnet onto the box and go in from the command
line.

If I go in from the browser and try and connect then I get this:

Warning: MySQL Connection Failed: Access denied for user:
'myuser@xxxxxxxxxxxxxxx' (Using password: YES) in
/home/sites/site2/web/test.php on line 27
Unable to connect to database

This is what I have in my HTML file:

$hostname = "http://www.mydomain.net";;
$username = "myuser";
$password = "mypassword";
$dbName = "mydatabase";

Line 27 is this:

MYSQL_CONNECT($hostname,$username,$password) OR DIE("Unable to connect to
database");

I suspect that it might be a path problem. Also, why does it say
@*ns*.mydomain.net in the error message?  If anyone can throw any light on
it I'd be grateful.

Best regards,

Andy





Assuming your username and password are correct, the problem is probably the
hostname.  When you set up a new user in mysql, they not only have to use
the correct username & password, but they can only connect from certain
servers that you specify.  On the mysql command line, you should type
something like this in order to access the db from your website instead of
the localhost:
Grant all privileges on db_name.* to user_name@domain_name identified by
'password';
You may want to replace the "all privileges" to only those that you specify
(ie - select, insert, update, etc...).
Best regards,
Bob c