All Products
Search
Document Center

E-MapReduce:Connect to a StarRocks instance using a client

Last Updated:Aug 20, 2026

This topic describes how to connect to a Serverless StarRocks instance using a MySQL client.

Prerequisites

A Serverless StarRocks instance has been created. For more information, see Create an instance.

Connect to StarRocks using a MySQL client on an ECS instance

For more information about how to create an ECS instance, see Quick start.

Important
  • If you use an internal network connection, ensure that the MySQL client and the StarRocks instance are in the same virtual private cloud (VPC) and vSwitch.

  • Add the IP address of the instance that hosts the MySQL client to a security group. The default port for the frontend (FE) node is 9030.

  1. Install the MySQL client. For more information, see Installing MySQL Shell.

  2. In the MySQL client, run the following command to connect to the StarRocks instance.

    mysql -hfe-c-*****.starrocks.aliyuncs.com -P 9030 -uadmin -p
  3. After the connection is established, you can perform operations.

Connect to StarRocks using an open source MySQL client

Step 1: Download the MySQL client and install the database

  1. Download the MySQL client.

  2. Run the following command to decompress the installation package.

    tar -zxvf mysql-5.6.40-linux-glibc2.12-i686.tar.gz
  3. Run the following command to copy the decompressed mysql directory to the local software directory on your system.

    cp mysql-5.6.17-linux-glibc2.5-i686 /usr/local/mysql -r
    Important

    Do not add a forward slash (/) to the end of the /usr/local/mysql directory path.

  4. Run the following command to add the mysql system group and the mysql user.

    sudo groupadd mysql
    sudo useradd -r -g mysql mysql
  5. Install the database.

    1. Run the following command to navigate to the MySQL software installation directory.

      cd /usr/local/mysql
    2. Run the following command to change the ownership of the current directory to the mysql user.

      chown -R mysql:mysql ./
    3. Run the following command to install the database.

      ./bin/mysql_install_db --user=mysql

      Alternatively, you can perform an initialization.

      sudo bin/mysqld --initialize --user=mysql
    4. Run the following command to change the ownership of the current directory to the root user.

      chown -R root:root ./
    5. Run the following command to change the ownership of the data directory to the mysql user.

      chown -R mysql:mysql data
    6. Run the following command to copy the file.

      cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
  6. Run the following command to start the MySQL service.

    sudo service mysql start

Step 2: Connect to the StarRocks instance

Run the following command to connect to the StarRocks instance.

/usr/local/mysql/bin/mysql -u admin -p -h fe-c-xxxxxx.starrocks.aliyuncs.com -P 9030
Note

fe-c-xxxxxxx.starrocks.aliyuncs.com is the public network address of the FE node of the EMR Serverless StarRocks instance.

You can find the address on the StarRocks instance's Instance Details page.