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 - V2.2.77Enterprise Edition

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive 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. V2.2.77
    iconOceanBase Database
    SQL - V 2.2.77Enterprise Edition
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    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

    Use OBClient to connect to an OceanBase Database tenant

    Last Updated:2023-08-18 09:26:34  Updated
    Share
    What is on this page
    Prerequisites
    Procedure
    Example

    folded

    Share

    OceanBase Client (OBClient) is a command-line client tool dedicated to OceanBase Database. You can use it to connect to two types of OceanBase Database tenants: MySQL and Oracle.

    Prerequisites

    You have obtained the OBClient installation package from the OceanBase technical support team.

    Procedure

    1. Open a command-line terminal.

    2. Specify the operating parameters to execute MySQL queries in the following formats:

      • Connection through an OBProxy:

        $obclient -h10.0.0.0 -u******@obmysql#obdemo -P2883 -p**1*** -c -A oceanbase
        

        Note

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

        • -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: Specifies the OceanBase Database connection port, which is also the listening port of OBProxy. The default value is 2883. You can customize the value as required.

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

        • -A: Indicates that the statistical information is not automatically retrieved when connecting to a MySQL tenant.

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

      • Direct connection:

        $obclient -h10.0.0.0 -u******@obmysql -P2881 -p**1*** -c -A oceanbase
        

        Note

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

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

        • -P: Specifies the OceanBase Database connection port. The default value is 2881. You can customize the value as required.

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

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

        • -A: Indicates that the statistical information is not automatically retrieved 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 you specified. Otherwise, you cannot connect to the tenant through this OBServer.

    3. After the connection is established, the following command-line prompt is displayed by default:

      obclient>
      
    4. If you want to exit the OceanBase command-line terminal, enter exit and press Enter, or press the shortcut key Ctrl + D .

    Example

    • Use OBClient to connect to a MySQL tenant of OceanBase Database:

      $obclient -h10.0.0.0 -u******@obmysql#obdemo -P2883 -p**1*** -c -A sys
      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 3221495183
      Server version: 5.7.25 OceanBase 2.2.77 (...) (Built Oct 23 2020 11:00:48)
      
      <Omitted>
      
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      
      obclient> SELECT SYSDATE() FROM dual;
      +---------------------+
      | SYSDATE()           |
      +---------------------+
      | 2020-12-24 13:52:11 |
      +---------------------+
      1 row in set (0.00 sec)
      
      obclient> exit
      Bye
      
    • Use OBClient to connect to an Oracle tenant of OceanBase Database:

      $obclient -h10.0.0.0 -u******@t_oracle0_91#obdoc -P2883 -p**1*** -c -A sys
      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 3221841095
      Server version: 5.7.25 OceanBase 2.2.74 (...) (Built Jul 15 2020 21:30:23)
      
      <Omitted>
      
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      
      obclient> SELECT SYSDATE FROM dual;
      +-----------+
      | SYSDATE   |
      +-----------+
      | 24-DEC-20 |
      +-----------+
      1 row in set (0.01 sec)
      
      obclient> exit
      Bye
      

    Previous topic

    Connect to a MySQL tenant from a MySQL client
    Last

    Next topic

    Database operations
    Next
    What is on this page
    Prerequisites
    Procedure
    Example