DBアカウントロック

(8.0.33)
https://dev.mysql.com/doc/refman/8.0/ja/account-locking.html
https://dev.mysql.com/doc/refman/8.0/ja/alter-user.html

 


drop user if exists user1;

create user user1@'%' identified by 'user1';
grant process on *.* to 'user1'@'%';

select Host, User, account_locked
from mysql.user;

 


alter user user1 ACCOUNT LOCK;
alter user user1 ACCOUNT UNLOCK;

 

 

 

 

(23c)

 

drop user if exists USER1;

create user USER1 identified by USER1;
grant connect to USER1;

alter session set NLS_DATE_FORMAT='YYYY/MM/DD HH24:MI:SS';

select USERNAME, ACCOUNT_STATUS, LOCK_DATE
from dba_users
where username='USER1';


ALTER USER USER1 ACCOUNT LOCK;


ALTER USER USER1 ACCOUNT UNLOCK;

 

(15)

drop user if exists user1;

create user user1 with login encrypted password 'user1';

\du

ALTER USER user1 NOLOGIN;

ALTER USER user1 LOGIN;

 

 

(2022)

use test
go

drop user user1;
go

use master
go

drop login user1;
go

create login user1 with password='user1', default_database=test, check_policy=off
go

use test
go


create user user1 for login user1;


alter login user1 ENABLE;

alter login user1 DISABLE;

select * from sys.server_principals;