mysql user authority command

New database user command: 

CREATE USER 'your user name' @ 'localhost' IDENTIFIED BY 'your password'; 
change the user name
Mysql> rename user OLD_NAME to NEW_NAME;
Mysql> rename user user name to new user name;
query all users
mysql> select user, host, password from mysql.user;

  Commands to modify database user permissions:

User authorization
Mysql> grant all on rulian. * To ljf @ '%' identified by '123456';
Mysql> grant select, insert, update, delete, alter, create, create view, show view, execute, index on rulian. * to ljf @ '%' identified by '123456';
Note: One is full operation authorization, and the other is targeted operation authorization.

Remove authorization;

Mysql> revoke all on rulian. * From 'ljf' @ '%';

Refresh the authorization form;
Mysql> flush privileges;
Note: It is used for configuration to take effect immediately.

 
Delete database user command: 

DROP USER your user name @ ' localhost ' ; 
query out all users of the database 

SELECT DISTINCT USER FROM mysql.user; 
restart Mysql command 

systemctl restart mysqld.service

 

Guess you like

Origin www.cnblogs.com/shenZS/p/12744108.html