This topic describes how to connect to a tenant in MySQL mode of an OceanBase Cloud instance by using OBClient.
Prerequisites
You have downloaded and installed the OBClient application. If you have not downloaded it, visit Software Center to download the appropriate version of OBClient.
You have obtained the connection string for the target tenant in MySQL mode in the OceanBase Cloud instance. For instructions, see Get a connection string.
Procedure
Open a command-line terminal locally.
Based on the connection string obtained in the prerequisites, run the following command to connect to the target tenant in MySQL mode under the OceanBase Cloud instance using the OBClient.
obclient -h ********.oceanbase.cloud -P 3306 -u ***** -D ***** -pParameter description:
-h: The connection address of the OceanBase Cloud database.-P: The connection port of the OceanBase Cloud database.-u: The name of the database account.-D: The name of the database to be accessed.-p: The account password.Note
For security, specify `-p` without a password value and enter the password when prompted. This keeps the password out of command-line arguments and shell history.
Example output:
Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 16 Server version: OceanBase 4.3.2.0 (r200000272024061717-93c0ed73ebbcac6edbf7b585860b75d825935358) (Built Jun 17 2024 18:06:04) 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 [oceanbase]>To exit the OBClient command line, type
exitand press Enter, or use the shortcut key Ctrl + D.