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

Prerequisites

The following operations are complete:

Use DMS to connect to an RDS instance

Data Management (DMS) is a graphical data management service that is used 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 the RDS instance, and then 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 the RDS instance.

Use a database client to connect to an RDS instance

ApsaraDB RDS is fully compatible with open source MariaDB. You can connect to the RDS instance from a common database client by using a similar method that can be used to connect to an open source MariaDB database. In the following example, HeidiSQL is used. For more information, visit the HeidiSQL website.

  1. Start HeidiSQL.
  2. In the lower-left corner of the Session manager dialog box, click New.
  3. Configure the following parameters. Connection settings
    ParameterDescription
    Network typeSelect the network type of the RDS instance. For this example, select MariaDB or MySQL (TCP/IP).
    LibrarySelect the dynamic-link library. For this example, retain the default value.
    Hostname / IPEnter the internal or public endpoint of the 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 MariaDB instance.
    • If HeidiSQL runs on an ECS instance that resides in the same region and has the same network type as the RDS instance, enter the internal endpoint of the RDS instance. For example, if the ECS and RDS instances both reside in virtual private clouds (VPCs) that belong to the China (Hangzhou) region, you can use the internal endpoint of the RDS instance to create a secure connection with low latency.
    • In the other scenarios, enter the public endpoint of the RDS instance.
    UserEnter the username of the account that is used to connect to the RDS instance. For more information about how to create an account on an RDS instance, see Create a database and account on an ApsaraDB RDS for MariaDB instance.
    PasswordThe password of the preceding account.
    PortEnter the port number that is used to connect to the RDS instance. If you want to connect to the RDS instance over an internal network, enter the internal port number of the RDS instance. If you want to connect to the RDS instance over the Internet, enter the public port number of the RDS instance. For more information, see View and change the internal and public endpoints and port numbers of an ApsaraDB RDS for MariaDB instance.
  4. Click Open.

    If the preceding parameters are properly configured, the RDS instance can be connected.

    Connection established

The following common errors may occur:

  • Unknown MySQL server hose 'xxxxxxxxx'(11001)

    If this error occurs, check that the Hostname / IP parameter is properly set. If this parameter is set to the ID or IP address of the RDS instance, the connection fails. You must set this parameter to the internal or public endpoint of the RDS instance.

  • Access denied for user 'xxxxx'@'xxxxx'(using password:YES)

    If this error occurs, check that the username and password of an account that is created on the RDS instance are properly specified. If you enter the username and password of your Alibaba Cloud account, the connection fails. You can create an account on the Accounts page of the RDS instance.

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

    If this error occurs, check that the IP address whitelists of the RDS instance are properly configured. You must make sure that the public IP address of the server that runs HeidiSQL is added to an IP address whitelist of the RDS instance. For more information about how to configure an IP address whitelist for an RDS instance, see Configure an IP address whitelist for an ApsaraDB RDS for MariaDB instance.

    Note You can temporarily add the 0.0.0.0/0 entry to an IP address whitelist of the RDS instance. If you can connect to the RDS instance by using HeidiSQL after the 0.0.0.0/0 entry is added, this error occurs due to an improperly configured IP address whitelist. You must obtain the actual public IP address of the server that runs HeidiSQL. 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 the built-in modules that are provided by the third-party dependencies in Function Compute to obtain data from your RDS instance. For more information, see Install third-party dependencies.