This topic describes how to connect to an OceanBase Database tenant by using OBClient.
Prerequisites
Contact OceanBase Technical Support to obtain the installation package of OBClient and install it correctly.
Procedure
Open a CLI terminal.
Specify the operating parameters of OBClient in the following format:
$obclient -h10.0.0.0 -P2881 -uroot@MySQL -p_**1***_ -ANote
Parameters
- -h: specifies the IP address for connecting to OceanBase Database, which is usually the IP address of an OBProxy.
- -u: specifies a tenant account in the Username@Tenant name#Cluster name or Cluster name:Tenant name:Username format. The default administrator username of an Oracle tenant is sys.
- -P: specifies the port for connecting to OceanBase Database, which is also the listening port of the OBProxy. Default value: 2883, which can be customized.
- -p: specifies the account password. For security reasons, you do not need to specify this parameter. In that case, you will be prompted to enter a password later. The password is invisible.
- -A: specifies not to retrieve the information of all tables to ensure a quick logon when you connect to OceanBase Database.
After the connection is created, the following default OBClient CLI prompt appears on the CLI terminal:
obclient>To exit the OBClient CLI prompt, enter
exitand press Enter, or press Ctrl+D.
Example
Connect to a MySQL tenant of OceanBase Database by using OBClient
$obclient -h10.0.0.0 -P2881 -uroot@MySQL -p_**1***_ -A
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 3221666749
Server version: 5.7.25 OceanBase 3.2.1 (...) (Built Sep 30 2021 19:59:46)
<Omitted>
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient> SELECT SYSDATE();
+---------------------+
| SYSDATE() |
+---------------------+
| 2021-10-22 15:51:13 |
+---------------------+
1 row in set