创建新用户 #
CREATE USER 'user'@'%' IDENTIFIED BY 'password';
设置用户权限 #
-- 部分权限
GRANT SELECT,INSERT ON database.* TO 'user'@'%';
-- 所有权限
GRANT ALL PRIVILEGES ON database.* TO 'user'@'%';
修改用户密码 #
SET PASSWORD FOR 'root'@'%' = 'xxx';
刷新权限 #
FLUSH PRIVILEGES;
删除用户 #
DROP USER 'user'@'host';