Mysql error

Mysql error

Posted by: mtewari
Posted on: 2007-11-05 09:08:00

Hi,
I am getting the following mysql error on my pages

"SELECT command denied to user 'www_data'@'hypnos.dreamhost.com' for table 'newspaper_links' "

Though I can connect with my username and password from the command line and everything works fine I can run select and other commands.

Appreciate any help in this regards.
Thanks,
mtewari

Re: Mysql error

Posted by: vicm3
Posted on: 2007-11-05 10:18:00

On your config file are the host server name correct? remember that you can't use 'localhost', also your username is correct? www_data?

mhhh... time to check the code on your pages... can we see a bit?

Regards.

Re: Mysql error

Posted by: mtewari
Posted on: 2007-11-05 15:54:00

Hi,
Yes I am using the right username and host, I can connect to the same database from command line and can successfully run select command however on the web page I get this error.
My Config file is as follows:
*******************************************************
<?php
$confg['db_uname'] = "www_data"; //your database username
$confg['db_paswd'] = "<pwd>"; //your database password
$confg['db_host'] = "mysql.mydomainname.com"; //usually localhost
$confg['db_dbase'] = "mydatabase"; //the database name
//$host="localhost";
########################################################
//create the function to log into the DB

function db_login() {

global $confg;

$link = @mysql_connect($confg['db_host'], $confg['db_uname'], $confg['db_paswd']) or die("Error connecting: " . mysql_error());

@mysql_select_db($confg['db_dbase'], $link);

}

//function for logging out from the DB

function db_logout() {

@mysql_close($link);

}
//$dbh=mysql_connect ("localhost") or die ('I cannot connect to the database because: ' . mysql_error());
//mysql_select_db ("blog") or die('I cannot select the database because: ' . mysql_error());
?>

Tags: mysql errori can rundreamhost