Jump to content


PHP denies access for user in MySQL database

  • Please log in to reply
1 reply to this topic

#1 essjay_d12

  • Members
  • PipPipPip
  • Advanced Member
  • 121 posts

Posted 30 May 2006 - 09:15 AM

I'm using the following packages....

php-4.3.3-Win32 and mysql-4.1.19-win32 on Apache

However i'm getting the following error...

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]SELECT command denied to user 'admin'@'localhost' for table 'films'.[/quote]

I'm trying to access in PHP like the following...

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
$conn = mysql_connect("localhost", "admin", "adm1n");

And my tables and users were created like the following in MySQL

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
CREATE TABLE films (ID_NO int(11) not null primary key, F_NAME varchar(100), F_DIRECTOR varchar(100), F_REVIEWER varchar(100), F_USERNAME varchar(50), F_DATETIME datetime, F_TYPE varchar(1000), F_SUMMARY varchar(2000), F_REVIEW varchar(10000), F_SCORE varchar(4));

GRANT ALL PRIVILEGES ON project TO 'admin'@'localhost' IDENTIFIED BY 'adm1n';

SET PASSWORD FOR 'admin'@'localhost' = OLD_PASSWORD('adm1n');[/quote]

What am I doing wrong??

Do I need a different version of either MySQL of PHP?



#2 poirot

  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 30 May 2006 - 01:50 PM

Probably because either "admin" has no privileges or maybe there's not even a user called "admin".

If you are using a server package to test on localhost, you should try "root" as username and "root" as password (or sometimes leave the password blank).
~ D Kuang

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users