创建一个新的用户username密码为password
CREATE USER username IDENTIFIED BY 'password';
查看所有的用户
select host,user from mysql.user;
给新建立的用户查询和插入的权限
GRANT SELECT, INSERT ON dbname.users TO 'username'@'%';
flush privileges;
查看所有用户的权限
show grants for 'username'@'%';
删除用户
DELETE FROM mysql.user WHERE user="username";
flush privileges;
select host,user from mysql.user;
撤回权限
evoke all on *.* from 'username'@'host';
flush privileges;
show grants for 'username'@'host';
给用户修改某一特定列权限
GRANT UPDATE(`column1`, `column2`) ON db.table TO 'username'@'%';
flush privileges;