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 command-line 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 ODP.
-u: specifies the tenant account in the User_name@Tenant_name#Cluster_name or Cluster_name:Tenant_name:User_name format. The default administrator username of an Oracle tenant is SYS.
-P: specifies the OceanBase Database connection port, which is also the listening port of ODP. The default value is 2883. You can customize the value as needed.
-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 successful connection, the following default OBClient command-line prompt appears on the command-line terminal:
obclient>To exit the OBClient command-line prompt, enter Exit and press Enter, or press Ctrl+D.
Examples
Use OBClient to connect to a MySQL tenant of OceanBase Database:
$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