Wednesday, January 14, 2009

Creating User and granting privilleges

Create user 'fun'@'localhost' IDENTIFIED BY 'fun'
The user should have global CREATE USER privilege or the INSERT privilege for the mysql database. For each account, CREATE USER creates a new row in the mysql.user table that has no privileges.

The user 'fun' can't acess mysql through telnet(i.e. from other machines).
GRANT ALL ON mydb.* TO 'fun'@'localhost';
it Grants all the privilege to user fun on the mydb database.

GRANT SELECT, INSERT ON somedb.* TO 'fun'@'localhost';
it grants the select and insert privilege on somedb database.

for more information http://dev.mysql.com/doc/refman/5.1/en/grant.html

No comments:

Post a Comment