Jump to content

PHP denies access for user in MySQL database


essjay_d12

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.