OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.1.0

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.1.0
    iconOceanBase Database
    SQL - V 4.1.0
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    Connect to an OceanBase Database tenant by using OBClient

    Last Updated:2023-08-01 06:02:28  Updated
    share
    What is on this page
    Prerequisites
    Procedure
    Connection example
    More information

    folded

    share

    This topic describes how to connect to a MySQL tenant of OceanBase Database by using OBClient.

    Prerequisites

    • The OBClient application is downloaded and installed. If OBClient is not downloaded, download the required version from OceanBase Download Center.

    • Before you connect to a tenant from a client, make sure that the client is in the allowlist of the tenant. For more information about how to query and configure a tenant allowlist, see Set and view the tenant allowlist.

    Procedure

    1. Open a command shell.

    2. Connect to OceanBase Database.

      You can connect to OceanBase Database directly or by using an OceanBase Data Proxy (ODP).

      • To connect to the MySQL tenant by using an ODP, run the following command:

        obclient -h10.10.10.1 -uusername@obtenant#obdemo -P2883 -ppassword -c -A oceanbase
        

        or

        obclient -h10.10.10.1 -uobdemo:obtenant:username -P2883 -ppassword -c -A oceanbase
        

        Parameters:

        • -h: the IP address for connecting to OceanBase Database, which is usually the IP address of an ODP.

        • -u: the tenant account. Two account formats are supported: Username@Tenant name#Cluster name and Cluster name:Tenant name:Username. The default username of the administrator of the MySQL tenant is root.

        • -P: the port for connecting to OceanBase Database, which is also the listening port of the ODP. Default value: 2883, which can be customized when ODP is deployed.

        • -c: specifies that comments must not be ignored in the runtime environment of OBClient.

        • -A: specifies not to automatically retrieve the statistical information when connecting to a MySQL tenant.

        • oceanbase: the name of the database to be accessed. You can change it to a business database.

        Example:

        obclient -h10.10.10.1 -u*****@obtenant#obdemo -P2883 -p****** -c -A oceanbase
        

        or

        obclient -h10.10.10.1 -uobdemo:obtenant:***** -P2883 -p****** -c -A oceanbase
        
      • To directly connect to the MySQL tenant, run the following command:

        obclient -h10.10.10.1 -uusername@obtenant -P2881 -ppassword -c -A oceanbase
        

        Parameters:

        • -h: the IP address for connecting to OceanBase Database, which is usually the IP address of an OBServer.

        • -u: the tenant account in the Username@Tenant name format. The default username of the administrator of the MySQL tenant is root.

        • -P: the port for connecting to OceanBase Database. Default value: 2881, which can be customized when OceanBase Database is deployed.

        • -p: 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.

        • -c: specifies that comments must not be ignored in the runtime environment of OBClient.

        • -A: specifies not to automatically retrieve the statistical information when connecting to a MySQL tenant.

        • oceanbase: the name of the database to be accessed. You can change it to a business database.

        • When you use the direct connection method, make sure that the tenant resources are distributed on the OBServer node you specified. Otherwise, you cannot connect to the tenant by using this OBServer node.

        Example:

        obclient -h10.10.10.1 -u******@obtenant -P2881 -p****** -c -A oceanbase
        
    3. After the connection is established, the following command-line prompt is displayed by default:

      obclient>
      
    4. To exit the OBClient command line, enter exit and press Enter, or press the shortcut key Ctrl + D.

    Connection example

    Connect to a MySQL tenant of OceanBase Database by using OBClient

    $obclient -h10.10.10.1 -u******@obmysql#obdemo -P2883 -p****** -c -A sys
    Welcome to the OceanBase.  Commands end with ; or \g.
    Your OceanBase connection id is 3221684181
    Server version: OceanBase 4.0.0.0 (r100000302022111120-7cef93737c5cd03331b5f29130c6e80ac950d33b) (Built Nov 11 2022 20:38:33)
    
    Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    obclient> SELECT SYSDATE() FROM dual;
    +---------------------+
    | SYSDATE()           |
    +---------------------+
    | 2022-09-28 16:18:18 |
    +---------------------+
    1 row in set
    
    obclient> exit
    Bye
    

    More information

    For information about how to connect to an Oracle tenant of OceanBase Database by using OBClient, see Connect to an OceanBase Database tenant by using OBClient.

    Previous topic

    Connect to an OceanBase Database tenant by using the mysql client
    Last

    Next topic

    Connect to OceanBase Database by using ODC
    Next
    What is on this page
    Prerequisites
    Procedure
    Connection example
    More information