MySQL用户新建,授权,删除,改密 数据简单导入导出
新建用户
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主机 数据库 > 路径 #导出