This topic describes how to lock and unlock an OceanBase Database user.
Lock and unlock a user using SQL statements
MySQL mode
The following are example statements for locking and unlocking a user in MySQL mode:
Lock a user
obclient> ALTER USER demo ACCOUNT LOCK; Query OK, 0 rows affected (0.02 sec) obclient -udemo@demo0_111 -P2881 -h10.10.10.1 -p****** obclient: [Warning] Using a password on the command line interface can be insecure. ERROR 3118 (HY000): User lockedUnlock a user
obclient> ALTER USER demo ACCOUNT UNLOCK; Query OK, 0 rows affected (0.02 sec) obclient -udemo@demo0_111 -P2881 -h10.10.10.1 -p****** obclient: [Warning] Using a password on the command line interface can be insecure. Welcome to the OceanBase monitor. Commands end with ; or \g. Your OceanBase connection id is 3222145887 ...... Copyright (c) 2000, 2018, OceanBase Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. obclient>
Oracle mode
The following are example statements for locking and unlocking a user in Oracle mode:
Lock a user
obclient> ALTER USER demo ACCOUNT LOCK ; Query OK, 0 rows affected (0.02 sec) obclient -udemo@demo0_111 -P2881 -h10.10.10.1 -p****** obclient: [Warning] Using a password on the command line interface can be insecure. ERROR 3118 (HY000): User lockedUnlock a user
obclient> ALTER USER demo ACCOUNT UNLOCK ; Query OK, 0 rows affected (0.02 sec) obclient -udemo@demo0_111 -P2881 -h10.10.10.1 -p****** obclient: [Warning] Using a password on the command line interface can be insecure. Welcome to the OceanBase monitor. Commands end with ; or \g. Your OceanBase connection id is 3221894166 ...... Copyright (c) 2000, 2018, OceanBase Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.