我是靠谱客的博主 跳跃龙猫,这篇文章主要介绍如何给用户授权,现在分享给大家,希望可以做个参考。

授权格式:grant 权限 on 数据库* to 用户名@登录主机 identified by '密码';

登录MYSQL,这里以ROOT身份登录:

mysql -u root -p

为用户创建一个数据库(testDB):

create database testDB; 
create database testDB default charset utf8 collate utf8_general_ci;

授权test用户拥有testDB数据库的所有权限:

grant all privileges on testDB.* to “test”@”localhost” identified by “1234”; 
flush privileges; #刷新系统权限表

指定部分权限给用户:

grant select,update on testDB.* to “test”@”localhost” identified by “1234”; 
flush privileges; #刷新系统权限表

授权test用户拥有所有数据库的某些权限:

grant select,delete,update,create,drop on . to test@”%” identified by “1234”; #”%” 表示对所有非本地主机授权,不包括localhost

 

转载于:https://www.cnblogs.com/TangGe520/p/8949806.html

最后

以上就是跳跃龙猫最近收集整理的关于如何给用户授权的全部内容,更多相关如何给用户授权内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(65)

评论列表共有 0 条评论

立即
投稿
返回
顶部