Pages

Monday, May 16, 2011

MySQL: USER CREATION & Setting UP Privileges


MySQL USER CREATION & Setting UP Privileges

To Check Current Privileges Of Any User

SHOW GRANTS;

To Create User

CREATE USER 'mifos_user'@'localhost';

SELECT user, host, password FROM mysql.user WHERE user='mifos_user';

To Grant SELECT , INSERT ,DELETE , UPDATE privileges

GRANT SELECT, INSERT, DELETE, UPDATE ON mifosdb.*
 TO 'mifos_user'@'localhost' IDENTIFIED BY 'mifos_user_pass';

Flush Privileges;

To show grants for particular user

SHOW GRANTS for 'mifos_user'@'localhost';


To Revote grant for particular

REVOKE DELETE, UPDATE ON mifosdb.* FROM 'mifos_user'@'localhost';

To Just Create User & Password Credentials

GRANT USAGE ON *.* TO 'mifos_user'@'localhost'
 IDENTIFIED BY 'NewPass';

To Grant ALL privileges

GRANT ALL ON mifosdb.* TO 'mifos_user'@'localhost'
 IDENTIFIED BY 'NewPass' WITH MAX_CONNECTIONS_PER_HOUR 10;

SHOW GRANTS for 'mifos_user'@'localhost';

To Grant ALL privileges
DROP USER 'mifos_user'@'localhost';

No comments: