Hi,

You should do this:

$connection=mysql_connect("host", "username", "password");

And then when querying:

$result=mysql_db_query("database", "select * from table");

>From your error message it seems that your database is called simply 'database', and 
>that the username is empty. This doesn't work.

You need to grant privileges to a user, like this:

grant select, insert, update, delete on database.* to username@"localhost" identified 
by 'password';

^^ Alter the words 'database', 'username' and 'password' on all the above to whatever 
you need. Of course, you need to have a database called 'database' too (which you can 
call whatever you want, of course) for this to work.


Best regards,
Haakon Nilsen
  ----- Original Message ----- 
  From: ketvin 
  To: [EMAIL PROTECTED] 
  Sent: Tuesday, September 23, 2003 11:23 AM
  Subject: Access denied


  Hi list,

  I am invoking mysql through php, so when i try to connect, 
  it gives me this error message as i connecting mysql as 
  localhost to 'database' database. While I dind't specify 
  user/passwd for that. 


  Access denied for user: '@localhost' to database 'database'







  Thanks





------------------------------------------------------------------------------


  -- 
  MySQL General Mailing List
  For list archives: http://lists.mysql.com/mysql
  To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to