1.添加用户
//只允许指定ip连接 create user \'新用户名\'@\'localhost\' identified by \'密码\'; //允许所有ip连接(用通配符%表示) create user \'新用户名\'@\'%\' identified by \'密码\';
2.分配权限
grant 权限列表 on 对象列表 to 用户@localhost identified by \'密码\';
3.回收权限
revoke 权限列表 on 对象列表 from 用户@localhost
参数: 权限列表:insert,update,delete,select,show,create,drop,alter,grant,revoke,all privileges 对象列表: 库.表 project.news,.... project.* 某个库下所有的表 *.* 所有的库所有的表