Skip to main content

Connect to seekdb by using a MySQL client

This topic describes the prerequisites, connection procedure, and examples of connecting to seekdb by using a MySQL client.

Prerequisites

Before you connect to seekdb by using a MySQL client, make sure that the following conditions are met:

  • You have installed a MySQL client. The supported versions of the MySQL client for the current version of seekdb are V5.5, V5.6, and V5.7.

  • The PATH environment variable contains the directory where the MySQL client commands are stored.

  • Before you connect to an instance, make sure that the client is in the allowlist of the instance. For more information about how to configure an allowlist, see Network security access control.

Procedure

To connect to seekdb by using a MySQL client, run the following command:

mysql -h$host -P$port -u$user_name -p****** [-c] [-A] [$database_name]

Parameter description:

  • -h: specifies the IP address for connecting to seekdb. Replace $host with the actual IP address. You can also use the local IP address or 127.0.0.1.

  • -P: specifies the port for connecting to seekdb. Replace $port with the actual port number. The default value is 2881, which can be customized during seekdb deployment.

  • -u: specifies the account for connecting to seekdb. The format of $user_name is username. The default username is root.

  • -p: specifies the password for connecting to seekdb. Replace ****** with the actual password string.

    info

    For security, we recommend that you do not enter the password in the command line, especially in an environment where scripts or command-line history are visible. You can omit this option and enter the password when prompted.

  • -c: optional. Specifies whether to ignore comments in the MySQL running environment.

    info

    Hint is a special comment that is not affected by -c.

  • -A: optional. Specifies whether to automatically obtain statistics when connecting to seekdb.

  • $database_name: optional. Specifies the default database to use after connecting to seekdb. If this parameter is not provided, no default database is automatically selected, and you need to select a database manually after connecting.

Example:

mysql -h127.0.0.1 -uroot -P2881 -p****** -c -A oceanbase

Examples

  1. Open a command-line terminal.

  2. Connect to seekdb by using a MySQL client.

    mysql -hxxx.xx.xxx.xxx -P2881 -uroot -p****** -A oceanbase

    The return result is as follows:

    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MySQL connection id is 3221614856
    Server version: 5.7.25 OceanBase 4.3.5.3 SeekDB (r1.0.0.0) (Built 100000262025111218-5343637512e28c346f938516af53b7879d4d5974 Nov 12 2025)

    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

    MySQL [(oceanbase)]>
  3. To exit the MySQL command-line interface, enter exit and press Enter, or press the Ctrl + D shortcut key.

More information

If you encounter issues while connecting to seekdb by using a MySQL client, we recommend that you consult the official documentation of the MySQL client.