Mysql 8.0 用户授权命令

错误的写法: 

GRANT ALL PRIVILEGES ON . TO ‘bbb’@’localhost’ IDENTIFIED BY ‘1qaz@WSX’;

 

正确的写法:

create user ‘bbb’@’localhost’ identified by ‘1qaz@WSX’; 

grant all privileges on . to ‘bbb’@’localhost’ ;

 

在授权的语句中需要去掉 IDENTIFIED BY ‘password’;

 

授予某种权限: 

GRANT SELECT ON oilsystem.input TO ‘aaa’@’localhost’

 

刷新权限: 

FLUSH PRIVILEGES; 

 

查看权限:

SHOW GRANTS FOR 'bbb'@'localhost';

 

收回某种权限: 

REVOKE SELECT ON *.*  FROM ‘bbb’@’localhost’;

你可能感兴趣的:(Linux,Mysql)