Self-hosted data source: MySQL

Updated at:

Add a MySQL data source to connect your MySQL database to Quick BI. After a successful connection, you can analyze and visualize your data in Quick BI. Quick BI supports connecting to MySQL over the public network or an internal network. This topic describes how to add a user-created MySQL data source.

Limitations

Quick BI supports MySQL versions 5.5, 5.6, 5.7, and 8.0.

Prerequisites

  • To connect to your MySQL database over the public network, add the Quick BI IP addresses to the database whitelist. For more information, see Use security groups.

  • If you connect Quick BI to your MySQL database over an internal network, use one of the following methods to enable network connectivity between the data source and Quick BI:

    • If your MySQL database is hosted on an Alibaba Cloud ECS instance, you can connect through a VPC.

    • You can also set up a bastion host and access the database through an SSH tunnel.

  • You have a user-created MySQL database and its corresponding username and password.

  • You have an AccessKey ID and AccessKey Secret for authentication. For more information, see Create an AccessKey.

Step 1: Configure the firewall

You must configure the firewall for your user-created database to allow external network access to MySQL.

  1. Run the following command to open the firewall configuration file:

    vi /etc/sysconfig/iptables
  2. Add the following rule to the firewall configuration file:

    -A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
  3. After adding the rule, run the following command to restart iptables:

    service iptables restart

Step 2: Add a self-hosted MySQL data source

  1. Log on to the Quick BI console.

  2. Follow these steps to add the data source.

    1. Open the page for creating data sources. For instructions, see Create a data source.

    2. On the Self-hosted Databases tab, select MySQL.

      image

  3. In the Configure Connection dialog box, configure the following parameters.image

    Parameter

    Description

    Display name

    The name of the data source as it will appear in the data source list. This name cannot contain special characters or leading or trailing spaces.

    Database address

    The IP address or domain name of the server where the MySQL database is deployed.

    Port

    The port number used to connect to the database.

    Database

    The name of the database that you specify when you deploy MySQL.

    Username and Password

    The username and password used to log on to the MySQL database.

    VPC Data Source

    Select VPC Data Source only if your MySQL database is deployed in a VPC on an Alibaba Cloud ECS instance. Then, configure the following parameters:

    • Purchaser AccessKey ID and Purchaser AccessKey Secret: The AccessKey ID and AccessKey Secret of the account used to purchase the instance.

      For more information, see Create an AccessKey.

      Note

      Make sure that the account has read permissions on the target instance. If the account also has write permissions, Quick BI automatically adds the required IP addresses to the security group whitelist. Otherwise, you must add them manually. For more information, see Create a custom RAM policy.

    • Instance ID: The ID of the ECS instance. Log on to the ECS console and go to the Instances page to view the instance ID.

      For more information, see View instance information.

    • Region: The region where the ECS instance is located. Log on to the ECS console and view the region in the upper-left corner of the page.

      For more information, see View instance information.

    SSL

    If SSL is configured for the target data source, you can select SSL to protect data in transit.

    SSH

    If you select SSH, you must configure the following parameters:

    You can set up a bastion host and use an SSH tunnel to access your database. Contact your operations team or system administrator to obtain the bastion host information.

    • SSH host: Enter the IP address of the bastion host.

    • SSH username and SSH password: The username and password used to log on to the bastion host.

    • SSH port: The port of the bastion host. The default port is 22.

    For more information, see Connect to a Linux instance by using OpenSSH or Xshell.

    Initialization SQL

    If you enable this option, you can specify SQL statements that run upon connection to the data source.

    Only SET statements are allowed. Separate multiple statements with semicolons (;).

    Enable file upload

    If you enable this option, you can upload files.

  4. Click Test Connection to verify the connection.

    image

  5. If the connection test is successful, click OK to add the data source.

    The new data source appears in the data source list.

    image

Next steps

After you create the data source, you can create a dataset to analyze your data.