MYSQL添加新用户,为用户建立数据库及分配权限操
日期:2015-02-06 / 人气: / 来源:网络
1.MYSQL新建用户
//登录MYSQL
@>mysql -u root -p
@>密码
//创建用户
mysql> insert into mysql.user(Host,User,Password) values(‘localhost’,'chinastor’,password(‘chinastor’));
//刷新系统权限表
mysql>flush privileges;
这样就创建了一个名为:chinastor 密码为:chinastor 的用户。
//退出后登录一下
mysql>exit;
@>mysql -u chinastor -p
@>输入密码
mysql>登录成功
2.MYSQL为用户授权
//登录MYSQL(有ROOT权限)。我里我以ROOT身份登录.
@>mysql -u root -p
@>密码
//首先为用户创建一个数据库(chinastorDB)
mysql>create database chinastorDB;
//授权chinastor用户拥有chinastor数据库的所有权限
@>grant all privileges on chinastorDB.* to chinastor@localhost identified by ‘chinastor’;
//刷新系统权限表
mysql>flush privileges;
mysql>其它操作
//如果想指定部分权限给一用户,可以这样来写:
mysql>grant select,update on chinastorDB.* to chinastor@localhost identified by ‘chinastor’;
//刷新系统权限表。
mysql>flush privileges;
mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
权限1,权限2,…权限n代表select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限。
当权限1,权限2,…权限n被all privileges或者all代替,表示赋予用户全部权限。
当数据库名称.表名称被*.*代替,表示赋予用户操作服务器上所有数据库所有表的权限。
用户地址可以是localhost,也可以是ip地址、机器名字、域名。也可以用’%’表示从任何地址连接。
‘连接口令’不能为空,否则创建失败。
例如:
mysql>grant select,insert,update,delete,create,drop on vtdc.employee to chinastor@192.168.1.8 identified by ‘888′;
给来自192.168.1.8的用户chinastor分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为888。
mysql>grant all privileges on vtdc.* to chinastor@192.168.1.8 identified by ‘888′;
给来自192.168.1.8的用户chinastor分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为888。
mysql>grant all privileges on *.* to chinastor@192.168.1.8 identified by ‘888′;
给来自192.168.1.8的用户chinastor分配可对所有数据库的所有表进行所有操作的权限,并设定口令为888。
mysql>grant all privileges on *.* to chinastor@localhost identified by ‘888′;
给本机用户chinastor分配可对所有数据库的所有表进行所有操作的权限,并设定口令为888。
3.MYSQL删除用户
@>mysql -u root -p
@>密码
mysql>DELETE FROM user WHERE User=”chinastor” and Host=”localhost”;
mysql>flush privileges;
//删除用户的数据库
mysql>drop database chinastorDB;
4.MYSQL修改指定用户密码
@>mysql -u root -p
@>密码
mysql>update mysql.user set password=password(‘新密码’) where User=”chinastor” and Host=”localhost”;
mysql>flush privileges;
mysql>quit;
浅谈重复数据删除技术的研究现状
导读:重复数据删除(data de-duplication)是一种可自动搜索重复数据,将相同的数据只保留唯一的一个副本,并使用指向单一副本的指针替换掉其它重复副本,以达到消除数据冗余、降低存储容量需求的存储技术。
重复数据删除技术,去重技术,
作者:管理员
推荐内容 Recommended
- 江苏飞浩信息科技期待您的加入07-20
- 江苏飞浩科技欢迎您07-19
相关内容 Related
- 江苏飞浩信息科技期待您的加入07-20
- 江苏飞浩科技欢迎您07-19