All Products
Search
Document Center

AnalyticDB:Redash

Last Updated:Mar 28, 2026

Redash is an open source business intelligence (BI) tool that connects to various data sources, including MySQL and PostgreSQL. This topic explains how to connect Redash to AnalyticDB for MySQL — either through an ADB MySQL endpoint or a Spark JDBC endpoint — and run your first query.

Prerequisites

Before you begin, ensure that you have:

Connect Redash to an ADB MySQL endpoint

Gather connection details

Before opening Redash, collect the following values from the AnalyticDB for MySQL console:

ParameterDescription
HostThe endpoint of the AnalyticDB for MySQL cluster. Use the internal endpoint if Redash runs on an Elastic Compute Service (ECS) instance in the same virtual private cloud (VPC) as the cluster. Use the public endpoint if Redash runs outside the VPC (for example, on a local server).
PortFixed at 3306.
UserThe database account of the cluster.
PasswordThe password of the database account.
Database nameThe database in the cluster.

Add AnalyticDB for MySQL as a data source

  1. Open Redash in your browser at http://<IP address>:<Port number>.

    • <IP address>: the IP address of the server where Redash is running.

    • <Port number>: the default port is 5000. If port 5000 is already in use, specify a different port when you start Redash.

  2. In the navigation pane on the left, click Settings. On the Data Sources tab, click + New Data Source.

    image

  3. In the Create a New Data Source dialog box, set Type Selection to mysql — AnalyticDB for MySQL is MySQL-compatible, so the MySQL driver works directly. Enter the connection details you gathered, then click Create.

    ParameterDescription
    Type SelectionSelect mysql from the drop-down list.
    NameA custom name for this data source.
    HostThe endpoint of the AnalyticDB for MySQL cluster (internal or public — see Gather connection details).
    PortFixed at 3306.
    UserThe database account of the cluster.
    PasswordThe password of the database account.
    Database NameThe database in the cluster.

    image

  4. In the navigation pane, choose Create > Query. Enter a SQL statement in the editor and click Execute.

    image

  5. After the query runs, click + New Visualization to create a chart from the results. See the Redash official documentation for visualization options.

    image

Connect Redash to a Spark JDBC endpoint

The Spark JDBC connection requires a custom query runner (adb_spark_ds.py) that you install into Redash before adding the data source.

Gather connection details

Before configuring Redash, collect the following values:

ParameterDescription
HostThe endpoint of the Spark Interactive resource group. See Preparations for how to find it.
PortFixed at 10000.
DatabaseThe database in the AnalyticDB for MySQL cluster.
UsernameThe database account of the cluster.
PasswordThe password of the database account.
Resource groupThe name of the Spark Interactive resource group.

Prepare the environment

Complete the following steps before adding the data source in Redash. The destination paths differ depending on whether you deployed Redash from source code or from a Docker image.

For Docker deployments, </app folder> refers to the /app folder inside the redash_server, redash_scheduler, redash_adhoc_worker, and redash_scheduled_worker containers.
  1. (Optional) Copy the adb_spark.png icon file to the following path:

    Deployment typeDestination path
    Source code<root directory of the source code>/client/app/assets/images/db-logos/
    Docker image</app folder>/client/dist/images/db-logos/
  2. Copy the adb_spark_ds.py query runner file to the following path:

    Deployment typeDestination path
    Source code<root directory of the source code>/redash/query_runner/
    Docker image</app folder>/redash/query_runner/
  3. Add 'redash.query_runner.adb_spark_ds' to the default_query_runners list in __init__.py: Append the entry at the end of the list:

    Deployment typeFile path
    Source code<root directory of the source code>/redash/settings/__init__.py
    Docker image</app folder>/redash/settings/__init__.py
    default_query_runners = [
        'redash.query_runner.athena',
        'redash.query_runner.big_query',
        ........
        'redash.query_runner.uptycs',
        'redash.query_runner.adb_spark_ds'
    ]

Add AnalyticDB for MySQL as a data source

  1. Open Redash. In the navigation pane on the left, click Settings. On the Data Sources tab, click + New Data Source.

    image

  2. In the Create a New Data Source dialog box, set Type Selection to ADB Spark. Enter the connection details you gathered, then click Create.

    ParameterDescription
    Type SelectionSelect ADB Spark from the drop-down list.
    NameA custom name for this data source.
    HostThe endpoint of the Spark Interactive resource group.
    PortFixed at 10000.
    DatabaseThe database in the AnalyticDB for MySQL cluster.
    UsernameThe database account of the cluster.
    PasswordThe password of the database account.
    Resource GroupThe name of the Spark Interactive resource group.

    image

  3. In the navigation pane, choose Create > Query. Enter a SQL statement in the editor and click Execute.

    image

  4. After the query runs, click + New Visualization to create a chart from the results. See the Redash official documentation for visualization options.

    image