Help Center/ Relational Database Service/ User Guide (Ally Region)/ FAQs/ Database Connection/ What Should I Do If an RDS Database Problem Causes a Connection Failure?
Updated on 2026-04-24 GMT+08:00

What Should I Do If an RDS Database Problem Causes a Connection Failure?

Check whether any of the following problems occurred on the RDS instance.

  1. The RDS instance is not properly connected.

    Solution: Check the connection. If you connect to the RDS instance through a private network, the ECS and RDS instance must be in the same VPC and the DB instance can be accessed only through this ECS. If you connect to the RDS instance through a public network, the ECS and DB instance can be in different VPCs.

  2. The maximum number of connections has been reached.
    • Solution for RDS for MySQL
      1. Check the application connections and release unnecessary connections.
      2. If max_connections is set to its default, you can upgrade the instance specifications.
      3. Check the instance metrics (including the CPU, memory, storage, and connections) and set alarm policies to identify potential issues early.
    • Solution for RDS for PostgreSQL

      Temporary solution:

      1. Run SQL statements to release idle connections as user root.

        For example, to query the idle connection of the user user, run the following SQL statement to obtain the process ID:

        SELECT * FROM pg_stat_activity WHERE state = 'idle' AND usename = 'user';

        Release the idle connection.

        SELECT pg_terminate_backend(pid);
      2. Change the value of max_connections and reboot your instance to apply the change.

      Permanent solution:

      1. Reduce database connections.
      2. If database connections cannot be reduced, upgrade the instance specifications.
  3. The DB instance is abnormal. For example, the RDS system fails, or the instance or table is locked.

    Solution: Contact technical support.