Skip to main content

Create MySQL Data Source

NineData supports adding various types and environments of data sources to the console for unified management. You can use database DevOps, backup and recovery, data replication, and database comparison features for data sources that have been added. This article introduces how to add a MySQL data source to NineData.

Prerequisites

  • The server IP address of NineData has been added to the data source allowlist. Please refer to the image below for instructions on how to obtain the server IP address.

    server_ip_address

  • Make sure you have available data source quota; otherwise, the data source cannot be added. You can quickly check your remaining quota at the top-right corner of the NineData console.check_quota

Operation Steps

  1. Log in to the NineData Console.

  2. On the left navigation pane, click > .

  3. Click  tab, and click  on the page. In the popup window for selecting the data source type, choose Database > (the type of data source to be added), and configure the parameters based on the table below on the page.
    tip

    If you make a mistake during the operation, you can click the arrow_down icon at the top of the page to make a new selection.

  1. Configure the parameters of the data source:

    Parameter
    Description
    NameEnter the name of the data source. To facilitate subsequent search and management, please use meaningful names.
    ConnectionChoose the access method of the data source. Supports access through IP Address, Gateway, SSH Tunnel three ways.
    • IP Address: Access the data source through a public network address.
    • Gateway: A secure and fast intranet access method provided by NineData, which requires the host where the data source is located to be connected first. For connection methods, please refer to Add Gateway.
    • SSH Tunnel: Access the data source through an SSH tunnel.
    Connection selection of IP AddressHost: The public network connection address and port of the data source.
    Connection selection of Gateway
    • Gateway: Select the NineData gateway installed on the host where the data source is located.
    • Host: Can be written as localhost (the data source is on the local machine) or the intranet IP of the host where the data source is located.
    Connection selection of SSH Tunnel
    • SSH Host: Enter the public IP or domain name of the server where the target data source is located, and the corresponding port number (the default port number for SSH service is 22).
    • SSH Authentication Method: Choose the SSH authentication method.
      • Password: Connect through SSH Username (i.e., the server's login name) and Password (i.e., the server's login password).
        • SSH Username: Enter the login username of the server where the target data source is located.
        • Password: Enter the login password of the server where the target data source is located.
      • Key (recommended): Connect through SSH Username and Key File.
        • SSH Username: Enter the login username of the server where the target data source is located.
        • Key File: Click Upload to upload the private key file, which is a key file without a suffix. If you have not created one yet, please refer to Generate SSH Tunnel Key File.
        • Password: Enter the password set when the key file was generated. If you did not set a password during the key generation process, leave this field blank.
    • Note: After the SSH configuration is completed, you need to click the Connection Test on the right, and there may be the following two results:
      • Prompt Connection Successfully: Indicates that the SSH Tunnel has been established.
      • Prompt error message: Indicates a connection failure, you need to troubleshoot the cause of the error and retry.
    • Host: Can be written as localhost (the data source is on the local machine) or the intranet IP of the host where the data source is located.
    Architecture TypeSelect the deployment architecture of MySQL.
    • Standalone: A standalone MySQL database deployed on a single machine, only one connection address and port are required.
    • Disaster Recovery: A MySQL database deployed with a disaster recovery architecture, usually including one master node and one or more disaster recovery nodes. You can click the Add button below Host to enter multiple node addresses and ports.
    • Read/Write Splitting: A MySQL database deployed with a read-write separation architecture, usually including one write node (master node) and multiple read nodes (slave nodes). You can click the Add button below Host to enter multiple node addresses and ports.
    DB AccountThe username of the data source.
    DB PasswordThe password of the data source.
    Access RegionSelect the region closest to your data source location to effectively reduce network latency.
    EnvironmentChoose according to the actual business purpose of the data source, as an environmental identifier for the data source. Default provides PROD and DEV environments, and supports you to create a custom environment.
    Note: Under the organization mode, the database environment can also be applied to permission policy management, for example, the default Prod Admin role only supports access to data sources in the PROD environment and cannot access data sources in other environments. For more information, please refer to Manage Roles.
    EncryptionWhether to use SSL encryption to access the data source (default on). If the data source enforces SSL encrypted connections, this switch must be turned on, otherwise, the connection will fail.
    Click the switch on the right to turn on or off encrypted transmission. Click the > to the left of Encryption to expand detailed configuration.
    • SSL Options: Supports the following two methods.
      • If Available: Automatically detect the server's SSL status, if the server has enabled SSL, it will connect through SSL first, if the server has not enabled SSL, it will connect in a non-SSL manner.
      • Require: Always use SSL to connect to the data source, if the server does not support this method or cannot establish an SSL connection for other reasons, the connection will fail.
    • SSL Cipher: Specify the SSL-Cipher encryption algorithm.
    • Verify Server Certificate (SSL CA): If the MySQL server uses a certificate issued by a self-signed CA, you need to upload the root certificate of this CA here.
    • Verify Server Identity (SSL Identify): Check to verify the server's name and IP address, etc., to ensure that the connection is to the real MySQL server and to prevent man-in-the-middle attacks.
    • Authenticate Client: If the MySQL server requires the client to provide a certificate, you need to upload the client's certificate and key here, and the MySQL server will verify the information you uploaded to ensure the security of the connection.
    Note: Under normal circumstances, if the MySQL server supports SSL encrypted connections, you only need to select Require, and there is no need to configure other options, the system will automatically generate a key for you to connect. For more SSL configuration methods, please refer to the official documentation: Configure MySQL Encrypted Connections.
  2. After all configurations are completed, click the Connection Test next to Create Datasource to test whether the data source can be accessed normally. If prompted with Connection Successfully, you can click Create Datasource to complete the addition of the data source. Otherwise, please recheck the connection settings until the connection test is successful.

Appendix: Add NineData's IP address to the MySQL database whitelist (self-built database environment)

When adding a data source located in On-Premise/Other Cloud, you need to add the IP address of the NineData service to the database whitelist to allow NineData to provide services.

This section takes MySQL 8.0 version as an example to introduce how to add an IP whitelist.

  • Create a new account: Log in to the database with the Root account and create an account for NineData access through the following command, and grant the corresponding permissions to this account.

    CREATE USER '<account name>'@'<NineData IP address>' IDENTIFIED BY '<access password>';
    GRANT <permission name> ON <database name>.* TO '<account name>'@'<NineData IP address>';
  • Existing account: Log in to the database with the Root account and add the NineData IP whitelist to the existing account and grant the corresponding permissions through the following command.

    GRANT <permission name> ON <database name>.* TO '<account name>'@'<NineData IP address>' IDENTIFIED BY '<access password>';
tip

When adding a MySQL data source, you need to use the account and corresponding password that added the NineData IP address mentioned above.