grant and revoke from a user for the selected commands

note: first you must be logged in as a root user

how to create a user?

syntax:
create user 

'username'@'host_name' 

identified by 'password if  nay';

example:

create user 'hello'@'localhost' identified by '123';


how to grant the specified commands (like select or insert etc) to the user?

grant select,delete on maxx to 'hello'@'localhost' identified by '123';


how to stop the user hello to use the select command

syntax:
revoke command_name,command_name 

on database_name.tablename 

from user_name;

example:

revoke select on maxx.dept from 'hello'@'localhost';





0 Comments