mysql 增加用户赋予权限

来源:互联网 发布:同花顺神奇电波 知乎 编辑:程序博客网 时间:2024/05/02 06:45

CREATE USER 'test'@'%' IDENTIFIED BY 'admin'; 创建用户test 密码为 admin 此时test用户只能访问普通数据库

赋权限 

grant all privileges on *.* to test@localhost identified by "123456" ;  //  创建新用户,用户名为testuser,密码为123456 ;

本地访问所有数据库所有表 管理员权限 

grant all privileges on *.* to test@"%"identified by "123456" ;  //  创建新用户,用户名为testuser,密码为123456 ;

外网访问所有数据库所有表 管理员权限 

grant all privileges on test.* to test@localhost identified by "123456" ;  //  创建新用户,用户名为testuser,密码为123456 ;

本地访问test数据库所有表 


grant all privileges on test.* to test@"%"identified by "123456" ;  //  创建新用户,用户名为testuser,密码为123456 ;

外网访问test数据库所有表 

flush privileges ; 让权限生效


0 0
原创粉丝点击