Lets learn some of the queries to create a user, grant access permission for user and revoke access.
Creating a user without password:
mysql> create user dbuser1;
Query OK, 0 rows affected (0.06 sec)
Creating a user with password:
mysql> create user dbuser2 identified by 'password';
Query OK, 0 rows affected (0.06 sec)
Setting password for a user with password():
mysql> set password for dbuser1 = password('password');
Query OK, 0 rows affected (0.01 sec)
Queries to give privileges to user are...
Global level:
GRANT ALL ON *.* TO 'dbuser'@'localhost';
GRANT ALL ON *.* TO 'dbuser';
Database level:
GRANT ALL ON mydb.* TO 'dbuser'@'localhost';
GRANT ALL ON mydb.* TO 'dbuser';
Table level:
GRANT ALL ON mydb.mytbl TO 'dbuser'@'localhost';
GRANT ALL ON mydb.mytbl TO 'dbuser';
For more information and example visit mysql doc
No comments:
Post a Comment