After you create an OceanBase tenant, you can verify the connectivity between the OBProxy service and OceanBase Database by using the following method:
Use the MySQL or OBClient to log on to the endpoint (IP address:port format) of OBProxy. Ensure that you can connect to OceanBase Database and run the test statements.
Example:
mysql -h[IP address of OBProxy] -P2883 -uroot@[Tenant name]#[Cluster name] -Dtest -p'test' -c -Ne "SELECT 'ok'"
Warning: Using a password on the command line interface can be insecure.
+----+
| ok |
+----+
Note
Connection parameters and descriptions:
-h: Specifies an IP address to connect to OceanBase Database, which is usually an OBProxy domain name.
-u: Specifies the connection account of the tenant. Supported formats: User name@Tenant name#Cluster name or Cluster name:Tenant name:User name. The default username of the administrator of a MySQL tenant is root.
-P: Specifies the OceanBase Database connection port, which is also the listening port of OBProxy.
-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.
-Ne: Executes an SQL statement when connecting to OceanBase Database in MySQL mode.
OK in the response indicates that the test is successful, and the client has connected to the OBServer node through the OBProxy. Notice
If you use the MySQL driver V8.0.16 or later on your client, an error occurs. We recommend that you use MySQL Connector/J V5.1.40. Download it at: https://downloads.mysql.com/archives/c-j/.