创建 OceanBase 数据库租户后,您可以通过以下方式验证 OBProxy 服务与 OceanBase 数据库的连通性。
使用 MySQL 或 OBclient 客户端登录 OBProxy 代理服务的 ip:port,确保能联通 OceanBase 数据库并执行测试语句成功。
连接 OceanBase 数据库
$obclient -h[OBProxy的IP地址] -P2883 -u[用户名]@[租户名]#[集群名] -p -A
Enter password:
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221583668
Server version: OceanBase 3.2.4.0 (r100000072022102819-2a28da9e758e2d232c41fa1a1b0070a08b77dd7d) (Built Oct 28 2022 19:46:38)
Copyright (c) 2000, 2018, OceanBase Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
说明
连接参数解释如下:
- -h:提供 OceanBase 数据库连接 IP,通常是一个 OBProxy 域名。
- -u:提供租户的连接账户,格式有两种:用户名@租户名#集群名 或者 集群名:租户名:用户名。MySQL 租户的管理员用户名默认是 root;Oracle 租户的管理员用户名默认是 SYS。
- -P:提供 OceanBase 数据库连接端口,也是 OBProxy 的监听端口。
- -p:提供账户密码,为了安全可以不提供,改为在后面提示符下输入,密码文本不可见。
- -c:表示在 MySQL 运行环境中不要忽略注释。
- -Ne:表示在 MySQL 连接数据库时执行 SQL 语句。