The syntax is as follows:
GRANT <privileges> ON <database(s)> TO <user@host -- this is not an e-mail addy> IDENTIFIED BY \'<a password>\' WITH GRANT OPTION
\"WITH GRANT OPTION\" is optional, it allows for you to login with that user name and give out access.
So, in your case:
login as root (mysql -u root -p)
enter password
create database some_db;
grant all on some_db. to me@localhost identified by \'myPassword\';
flush privileges; (I don\'t think this is neccessary, but what the hey, do it anyways!)
exit
login as \"me\" (mysql -u me -p some_db)
enter password
create your tables and run your queries
That setups up a user \"me\" which is allowed to login from only the localhost (if you want to allow access from other machines (like say a different webserver, you\'d need to use their IP/DNS/or \'%\').
More syntax is here:
http://mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Adding_users
Good luck!🙂
-P
C Bullock wrote:
I have read and re-read the security section in a mySQL book I have, and am just not getting it. What I am not entirely getting is the GRANT statement. I want to create a database such that the user \"test\" can do most anything (inserts, deletes, selects, create tables, etc) with a password of \"foo\". Would the statement
GRANT ALL ON * TO test@localhost \'foo\';
do what I am needing it to do? Is the first part of the email (before the @) the username?
Thank you.
Chester