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

MySQL用户新建,授权,删除,改密 数据简单导入导出

2012-12-18 13:49 661 查看
新建用户

insert into mysql.user(Host,User,Password) values("localhost","用户名",password("密码"));
flush privileges;


授权

grant all privileges on 数据库.* to 用户名@localhost; #所有权限
grant select privileges on 数据库.* to 用户名@localhost; #查
grant insert privileges on 数据库.* to 用户名@localhost; #写
grant update privileges on 数据库.* to 用户名@localhost; #更新
grant delete privileges on 数据库.* to 用户名@localhost; #删除
grant insert,update privileges on 数据库.* to 用户名@localhost; #查,写
flush privileges;


删除用户

delete from user where User="用户名";
flush privileges;


改密

update mysql.user set password=password('新密码') where User="用户名";
flush privileges;


导入导出

mysqldump -u用户名 -p密码 -h主机 数据库 < 路径 #导入
mysqldump -u用户名 -p密码 -h主机 数据库 > 路径 #导出
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: