当前位置:网站首页>mysql_ Account authorization permission recycling, account locking and unlocking, account creation and deletion

mysql_ Account authorization permission recycling, account locking and unlocking, account creation and deletion

2022-07-25 03:01:00 angela_ dba_ chao

1 Create account

CREATE USER 'useraccount'@'%' IDENTIFIED BY 'password';

2 Account empowerment

GRANT ALL ON *.* TO 'useraccount'@'%' WITH GRANT OPTION;

FLUSH PRIVILEGES; 

3 View account permissions

show grants for [email protected]`%`;

4 Account permission withdrawal

revoke all privileges on *.* from `useraccount`@`%`;

5 Lock account

ALTER USER 'useraccount'@'%' ACCOUNT LOCK;

6 Check whether the account is unlocked

SHOW CREATE useraccount

select host,user,account_locked from mysql.user where user in ('useraccont');

7 Unlock account

ALTER USER [IF EXISTS] useraccount ACCOUNT UNLOCK;

8 Delete the account

drop user useraccount;

delete from user where user='useraccount' and host='%';

原网站

版权声明
本文为[angela_ dba_ chao]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/202/202207200529252654.html