create user 'king' identified by '1234';
show grants for 'king'
use mysql; select * from user where user ='king';
#授予权限
grant insert on *.* on 'king'@'localhost' identified by '123'; //只允许本机登陆 grant insert on *.* on 'king'@'192.168.1.20' identified by '123'; //只允许指定ip以该用户登陆 grant insert on *.* on 'king'@'%' identified by '123'; //允许远程登陆 grant all on *.* on 'king'@'%' identified by '123' with grant option; //允许该用户赋予其他用户他所拥有的权限 ,all代表所有权限
revoke 权限类型 on 对象 from 'king';
drop user 'king';
(1)通过mysqladmin修改:
mysqladim -u用户 -p passwd 新密码输入后会提示输入旧密码,输入正确后便能修改密码
(2)通过update修改user表中的password字段:
use mysql; update user set password = password('新密码') where user = '用户名';(3)通过set命令修改
set password for '用户名'=password('新密码');