您的位置:首页 > 数据库 > MySQL

MySql全套攻略——添加新用户、为用户创建数据库和给用户分配权限

2018-05-27 11:38 127 查看
1.添加新用户
只允许本地IP访问
create user 'test'@'localhost' identified by '123456';

允许外网IP访问

create user 'test'@'%' identified by '123456';
刷新授权
flush privileges;
2.为用户创建数据库
create database test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
3.为用户分配权限

授予用户通过外网IP操作该数据库的所有去权限

grant all privileges on `testdb`.* to 'test'&'%' identified by '123456';
授予用户通过外网IP操作所有数据库的权限
grant all privileges on *.* to 'test'&'%' identified by '123456';
刷新授权
flush privileges;







阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐