美文网首页
mysql用户管理

mysql用户管理

作者: StoneHeart | 来源:发表于2016-01-06 14:15 被阅读61次

导入数据库
新建数据库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;

相关文章

网友评论

      本文标题:mysql用户管理

      本文链接:https://www.haomeiwen.com/subject/rtvxkttx.html