mysql 用户管理

时间:2014-10-20 17:09:42   收藏:0   阅读:247

1、初始安装修改root密码

mysqladmin -uroot password newpassword;

2、新建用户

//创建了一个名为:jeecn  密码为:jeecn  的用户。
mysql> insert into mysql.user(Host,User,Password) values(‘localhost’,jeecn’,password(‘jeecn’));
//或者
//create user jeecn;
//update user set Password = PASSWORD("jeecn") where user=‘jeecn‘;
//刷新系统权限表 mysql>flush privileges;


3、用户授权

mysql>grant all privileges on testdb.* to jeecn@localhost identified by ‘jeecn’;
 //刷新系统权限表
mysql>flush privileges
//grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;
//权限n代表select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限

 

参考:

[1] 网名还没想好.MYSQL添加新用户 MYSQL为用户创建数据库 MYSQL为新用户分配权限[2014-10-20](2012-05-23).http://www.cnblogs.com/ymy124/archive/2012/05/23/2514196.html
 

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!