Jump to content

Archived

This topic is now archived and is closed to further replies.

essjay_d12

PHP denies access for user in MySQL database

Recommended Posts

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");
mysql_select_db("project",$conn);[/quote]

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?

Thanks

Simon

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.