1.创建用户
本机登录
create user 'wangdachui'@'localhost' by '密码'
任意地方登录
create user 'wangdachui'@'%' identified by '密码'
2.授权操作
授予全部权限
grant all privileges on . to 'wangdachui'@'localhost';
第一个所有数据库 第二个所有对象
grant all privileges on . to 'wangdachui'@'localhost' with grant option ;
with grant option使得这个用户拥有给别的用户授权的操作
取消授权操作
revoke all privileges on . from 'wangdachui'@'localhost';
授予部分权限
grant select on shcool.* to 'wangdachui'@'localhost';
grant delete,drop on shcool.* to 'wangdachui'@'localhost';