1 创建账号
CREATE USER 'useraccount'@'%' IDENTIFIED BY 'password';
2 账号赋权
GRANT ALL ON *.* TO 'useraccount'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
3 查看账号权限
show grants for useraccount@`%`;
4 账号权限收回
revoke all privileges on *.* from `useraccount`@`%`;
5 锁定账号
ALTER USER 'useraccount'@'%' ACCOUNT LOCK;
6 查看帐户是否已解锁
SHOW CREATE useraccount
select host,user,account_locked from mysql.user where user in ('useraccont');
7 解锁账号
ALTER USER [IF EXISTS] useraccount ACCOUNT UNLOCK;
8 删除账号
drop user useraccount;
delete from user where user='useraccount' and host='%';