Page 1 of 1

[SOLVED] Do I need USER account in MySQL db for PHP query?

Posted: Thu Jan 22, 2004 6:54 pm
by Calimero
Hello,
//*This my first POST here, so
IF (I make an error)
THEN (Please forgive me)
ELSE (Tell me how to avoid making one in the future)

WHILE (I was working on my Search Eng.
I screened a lot of PHP-scripts but still I dont know how the language functions, However I have medium knowledge of MySQL
[b]So I encountered a problem,
Whenever PHP script queryies mysql_db there is a part of the code concerning: host, user and pass
in the exapmles those were usualy localhost, -u, -p.
MY QUESTION - DO I NEED TO MAKE NEW USER IN THE DATABASE - DB IS ON MY HOSTING PROVIDERS SITE ( AND I GOT PASSWORD TO MANAGE IT ), AND GRANT HIM (USER) SOME PRIVILEDGES AND RELATED STUFF, OR DO I JUST QUERY DB WITH PHP. MY CONCERN IS THAT NO ONE WILL BE ALLOWED TO INSERT - UPDATE - DELETE - DROP SOMETHING IN THE DATABASE, AND I DONT UNDERSTAND IF THE PHP CAN DO IT, WHY CANT SOMEONE FROM THE INTERNET DO THE SAME THING - JUST ALTER THE CODE AND MAKE ME SUFFER :)[/b]
I already have some books on PHP, BUT they just tell about some segments of PHP, I can't learn logic of the language from them - And I see that PHP and MySQL logic differs considerably.

THANKS AHEAD... AND IF POSSIBLE REPLY TO THIS AS SOON AS POSSIBLE, BECAUSE I MUST FINISH THIS IN TWO WEEKS. :)

Posted: Thu Jan 22, 2004 6:56 pm
by markl999
Yes, you need to use the mysql username and password the host has supplied.
You also appear to have a broken caps lock key :o

So how do I grant my PHP script access to query DB

Posted: Fri Jan 23, 2004 8:02 pm
by Calimero
I have MySQL db, I will write php scripts that will query db, but how do I grant permission to PHP scripts to query (SELECT, INSERT, DELETE) db, but no one else can be allowed to do so.
I know about GRANT command in MySQL,
GRANT <privileges> ON <database> TO <user> [IDENTIFIED BY <password> ------- HOW to edit <user> and INDENTIFIED BY commands to adapt them to php query (is thios done in the PHP or mysql

Thanks
markl999 for the answer

And thanks ahead for the next one :D