All Products
Search
Document Center

AnalyticDB:Use the MySQL command-line client to connect to AnalyticDB for MySQL

Last Updated:Mar 28, 2026

Connect to an AnalyticDB for MySQL cluster using the MySQL command-line client to run queries and manage your database remotely.

Prerequisites

Before you begin, ensure that you have:

  • Added the IP address of the machine running the MySQL command-line client to the IP address whitelist of your cluster. If you haven't configured a whitelist yet, see Configure a whitelist.

Connect to the cluster

  1. Get the cluster endpoint from the AnalyticDB for MySQL console:

    1. On the Cluster Information page, go to the Network Information section.

    2. Copy the endpoint displayed there.

  2. Run the following command to connect:

    mysql -h<adb_url> -P3306 -u<adb_user> -p<adb_password>

    Replace the placeholders with your actual values:

    PlaceholderDescriptionExample
    <adb_url>Endpoint of the cluster, copied from the Network Information section of the Cluster Information pagemv-bp1sehs22w****.ads.aliyuncs.com
    3306Port number. Fixed value — do not change3306
    <adb_user>Database account. Use a privileged account or a standard account with the required permissionstest
    <adb_password>Password of the database accountTest123

Example

mysql -hamv-bp1sehs22w****.ads.aliyuncs.com -P3306 -utest -pTest123