mysql用户管理

导入数据库
新建数据库mysql>create database abc;
选择数据库mysql>use abc;
设置数据库编码mysql>set names utf8;
导入数据mysql>source /home/abc/abc.sql;

创建新用户
   create user username identified by 'password';
分配用户权限(所有权限)
    grant all privileges on ‘.’ to 'username'@'localhost' identified by 'password';
撤销刚才权限用root用户撤销刚才权限,并重新授权
    evoke all privileges on ‘.’ from 'username'@'localhost';
    grant all privileges on database.* to 'username'@'localhost' identified by 'password';
指定用户只能执行select和update命令:
    grant select,update on database.* to 'username'@'localhost' identified by 'password';
刷新权限
     flush privileges;
删除用户
     drop  user username@localhost;
查询相应的用户及对应的host
     select user,host from user;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容