Authority

CREATE USER 'username'@'host' IDENTIFIED BY 'password';
GRANT privileges ON databasename.tablename TO 'username'@'host'
REVOKE privilege ON databasename.tablename FROM 'username'@'host';
DROP USER ‘username’@'host’;
flush privileges;	最后不要忘记刷新数据库

创建用户
create user 'homestead'@'localhost' identified by 'YES';

授权
grant all on privileges on wiki.* to mars@localhost
GRANT ALL ON example_database.* TO 'example_user'@'%';

GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.17.0.1' IDENTIFIED BY 'pwabc123' WITH GRANT OPTION
delete from mysql.user where host = '172.17.0.1' and user = 'root'

grant all on *.* to 'homestead'@'localhost';
GRANT SELECT, INSERT ON test.user TO 'pig'@'%'; 
GRANT ALL ON *.* TO 'pig'@'%';

设置与更改用户密码
SET PASSWORD FOR 'username'@'host' = PASSWORD('newpassword');

如果是当前登陆用户用
SET PASSWORD = PASSWORD("newpassword");

撤销用户权限
REVOKE SELECT ON *.* FROM 'pig'@'%';

删除用户