mysql 固定用户赋值数据库权限

// 新增用户

create user 'test'@'%' identified by '123456';

#test:用户名,%:所有ip地址,123456:密码


#授权给用户test,数据库test_db相关的所有权限,并且该用户test在所有网络IP上都有权限,%是指没有网络限制

grant all privileges on `test_db`.* to 'test'@'%' identified by '123456';

# 给用户设置所有库的权限 grant all privileges on
*.* to 'test'@'%' identified by '123456';
# 设置具体权限
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON TUTORIALS.
* TO 'zara'@'localhost' IDENTIFIED BY 'zara123';

 

// 刷新权限:

flush privileges;

 

参考资料:

https://www.cnblogs.com/faberbeta/p/mysql002.html

posted @ 2021-09-23 15:23  译林  阅读(68)  评论(0编辑  收藏  举报