Mysql权限控制

19. October 2018 DataBase 0

开发过程中使用mysql的root用户进行操作配置等是意见很危险的事,用户权限应分门别类,主要是授权操作,drop操作和alter操作.

查看用户:

SELECT `user`,`Host` from mysql.`user`

增加用户:

create user 'muu'@'%' IDENTIFIED by 'password'

授权操作:

GRANT SELECT,UPDATE,DELETE,INSERT,ALTER,CREATE ONcollege.* to 'muu'@'%'

查看授权操作:

show GRANTS FOR muu

取消授权操作:

REVOKE SELECT, INSERT, UPDATE, DELETE on college.* FROM muu