Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL on Win 2000 Server

Status
Not open for further replies.

buzzt

Programmer
Oct 17, 2002
171
CA
I have a small, yet serious issue. Since I have installed MySQL on my server, I have not been able to use any other user that 'root' to interact with my databases via PHP on the web. Whenever I grant priveledges to any user (including ALL) they just do not work when I try to access the database from PHP. This means that I cannot add, or delete users from my databases via the web. Does anybody know what might be wrong?

I have been told that I should just add PHPMyAdmin to the server and use that rather than the command line, but I would rather not do that.
 
Is PHP running on the same machine as MySQL?

If not, are you giving that user permissions from the PHP machine? MySQL user credential tuples are of the form "username/password/IP_address" ______________________________________________________________________
TANSTAAFL!
 
Yes PHP is installed on the same server.
 
Okay, next question. What error messages is PHP reporting? Specifically, when your mysql_connect() fails, what error does mysql_erro() report? ______________________________________________________________________
TANSTAAFL!
 
Warning: Access denied for user: 'broad@localhost' (Using password: YES) in THE PATH ON MY SERVER\db_fns.php on line 5 (which is where the username and password are).

 
I'm just throwing out the dumb ideas here...

Does the user broad have the right to log on from localhost?

Is localhost defined? ______________________________________________________________________
TANSTAAFL!
 
Well...root and password work on localhost. I'm a little fuzzy on what exactly you mean...I have granted the user broad the priveledges...
 
To log onto MySQL, you must provide a userid and password that match an already defined user. MySQL also limits from where that user can log in.

For the user to get in from localhost, the user must be explicitly given rights to login from localhost.

Something like:
GRANT all on <databasename>.tablename to <username>@<ip address> identified by &quot;<password>&quot;

You can specify <username>@'%' to mean any host (and MySQL is supposed to default to that). ______________________________________________________________________
TANSTAAFL!
 
My grant right now reads as

GRANT USAGE ON *.* TO 'broad'@'%' IDENTIFIED BY PASSWORD 'PASS'

GRANT SELECT, INSERT, UPDATE, DELETE ON ada.* to 'broad'@'%'
 
Have you tried giving permissions explicitly to broad@'localhost' ? ______________________________________________________________________
TANSTAAFL!
 
Also, have you issued a FLUSH PRIVILEGES after granting actual privileges to the user &quot;broad&quot;? ______________________________________________________________________
TANSTAAFL!
 
Perfect! The combination of RELOAD and FLUSH-PRIVILEGES seems to have corrected the problem. Thanks for all the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top