create user 'test'@'localhost' identified by 'password';
create user 'test'@'%' identified by 'password';
flush privileges;
set password for 'test'@'localhost' = password('newpassword');
如果是当前用户:
SET PASSWORD = PASSWORD("newpassword");
授权相关操作见 Mysql 数据库设置远程权限
这里补充一下 MySql 移除权限的命令:
REVOKE privilege ON databasename.tablename FROM 'username'@'localhost';
drop user 'username'@'localhost'