This topic describes how to connect to an ApsaraDB RDS for MariaDB instance. After you complete the initial configuration, you can connect to your RDS instance from an Elastic Compute Service (ECS) instance or your computer.

Prerequisites

The following operations are completed:

Use DMS to connect to an RDS instance

Data Management (DMS) is a graphical data management service that allows you to manage relational databases and NoSQL databases. It provides various features, such as data management, schema management, user authorization, security audit, trend analysis, data tracking, business intelligence (BI) charts, and performance analysis and optimization.

Log on the ApsaraDB RDS console, find your RDS instance, and go to the Databases page. On the Databases page, find the database that you want to manage, and click SQL Query in the Actions column. On the logon page of DMS, enter the information that is used to connect to your RDS instance.

SQL Query

Method 2: Use a database client

ApsaraDB RDS for MySQL is fully compatible with open source MySQL. You can connect to your RDS instance from a database client by using a similar method that you use to connect to an open source MySQL database. In the following example, the HeidiSQL client is used.

  1. Start the HeidiSQL client.
  2. In the lower-left corner of the Session manager dialog box, click New.
  3. Configure the following parameters. Connection settings
    Parameter Description
    Network type Select the network type of your RDS instance. For this example, select MySQL (TCP/IP).
    Library Select the dynamic-link library. For this example, leave this parameter at the default value.
    Hostname / IP Enter the internal or public endpoint of your RDS instance. Example: rm-bp1xxxxxxxxxxxxxx.mysql.rds.aliyuncs.com. For more information about how to view the internal and public endpoints of an RDS instance, see View and change the internal and public endpoints and port numbers of an ApsaraDB RDS for MySQL instance
    • If the database client runs on an Alibaba Cloud Elastic Compute Service (ECS) instance that resides in the same region and has the same network type as your RDS instance, enter the internal endpoint. For example, if the ECS and RDS instances both reside in virtual private clouds (VPCs) of the China (Hangzhou) region, you can use the internal endpoint to establish a secure and efficient connection.
    • In the other scenarios, enter the public endpoint.
    User Enter the username of the account that is used to connect to your RDS instance. For more information about how to create an account, see Create accounts and databases for an ApsaraDB RDS for MySQL instance.
    Password Enter the password of the preceding account.
    Port Enter the internal or public port number of your RDS instance. If you want to connect to your RDS instance over an internal network, enter the internal port number. If you want to connect to your RDS instance over the Internet, enter the public port number. For more information, see View and change the internal and public endpoints and port numbers of an ApsaraDB RDS for MySQL instance.
  4. Click Open.

    If the connection information is properly configured, your RDS instance can be connected.

    Connection established

The following common errors may occur:

  • The "Unknown MySQL server hose 'xxxxxxxxx'(11001)" message is returned.

    If this error occurs, check whether the Hostname / IP parameter is properly set. If this parameter is set to the ID or IP address of your RDS instance, the connection cannot be established. Set this parameter to the internal or public endpoint of your RDS instance.

    Internal and public endpoints
  • The "Access denied for user 'xxxxx'@'xxxxx'(using password:YES)" message is returned.

    If this error occurs, check whether the account information is properly configured. If you enter the username and password of your Alibaba Cloud account, the connection cannot be established. Enter the username and password of an account that is created on the Accounts page of your RDS instance.

    Accounts
  • The response is slow and the "Can't connect to MySQL server on 'rm-bp1xxxxxxxxxxxxxx.mysql.rds.aliyuncs.com'(10060)" error message is returned.

    If this error occurs, check whether the whitelist settings of your RDS instance are properly specified. Make sure that the public IP address of the database server where the HeidiSQL client is installed is added to an IP address whitelist of your RDS instance. For more information about how to specify whitelist settings, see Control access to an ApsaraDB RDS for MySQL instance.

    Note You can temporarily add the 0.0.0.0/0 entry to an IP address whitelist. This allows you to check whether this error is caused by improper whitelist settings. If the whitelist settings are improper, you must add the actual IP address of the database server to an IP address whitelist. For more information, see Why am I unable to connect to my ApsaraDB RDS for MySQL or ApsaraDB RDS for MariaDB instance from a local server over the Internet?

FAQ

How do I use Function Compute to obtain data from my RDS instance?

You can install third-party dependencies on Function Compute. Then, you can use these built-in dependencies to obtain data from your RDS instanceFor more information, see Install third-party dependencies.