All Products
Search
Document Center

ApsaraDB for OceanBase:Connect to a database

Last Updated:Apr 19, 2023

After creating a user, you need to obtain the following information from the tenant page of the console to connect to the database:

  1. Configure a whitelist: Set the whitelist to the public endpoint or private IP address that is used to access the database. On the information tab page, click modify in the whitelist column to modify the whitelist.

  2. IP address and port number: On the connection information tab page of the, you can find the primary address in the address bar.

    • Public endpoint: consists of an IP address and a port number, which is accessible from the external network. You need to access the connection information tab page for the first time and then click apply for .

    • Private network address: an address that is accessible to the internal network of Alibaba Cloud. It consists of an IP address and a port number. Can be obtained directly.

  3. Database User information: On the page, click the Account tab to obtain the database user information.

OceanBase client

The OceanBase OBClient is compatible with both MySQL and Oracle tenants. Therefore, we recommend that you use OBClient to connect to OceanBase.

Connection format:

obclient -h [IP address] -P [port number] -u [user name] -p [password] -D [Database name] -c

MySQL client

Apsaradb for OceanBase is fully compatible with the MySQL protocol. Therefore, you can use a standard MySQL client to connect to MySQL tenants of apsaradb for OceanBase. We recommend that you use a MySQL client whose version is 5.6 or 5.7. The MySQL client cannot be used to connect to an OceanBase Oracle tenant. To connect to an Oracle tenant, use the OceanBase client.

Connection format:

mysql -h [IP address] -P [port number] -u [user name] -p [password] -D [Database name] -c