All Products
Search
Document Center

DMS cannot connect to the MySQL server and reports an error: check the connection address, network access, and whitelist settings.

Last Updated: Feb 25, 2021

Problem description

We failed to connect to the MySQL server because DMS and the MySQL server cannot be connected. We recommend that you check the connection strings, network conditions, and whitelist settings before trying again. The error occurred, the system displays a similar output:

Cause

This problem generally occurred on the self-built MySQL server. The possible causes of the problem are as follows.

  • The Firewall limits of the ECS instance or the host where the user-created MySQL server is located.

  • The ECS Security Group is not open to DMS.

  • MySQL server not started.

  • MySQL servers only allow local login by the root account.

Solution

In response to the above problems, please check the following settings in sequence.

  1. Check the firewall rules of the ECS instance or the MySQL server. Confirm that the MySQL service port (the default port is 3306) is open. Confirm that the IP address of DMS is not restricted or add to the firewall whitelist. For more information, see what is the IP address used to log on to ECS in DMS?

  1. Add the IP address of the DMS enterprise to the inbound settings of the security group of the ECS instance.

  1. On the MySQL server, run the following command to check whether the MySQL process is normal:

    ps -ef | grep mysql
  1. If the MySQL process is normal, log on to the MySQL server as the root user and run the following command to check whether the root account is only allowed to log on to the local server.

    show grants for root@'%';
  2. If the root account is only allowed to log on locally, run the following command to allow the root account to log on from any remote address.

    use mysql; update user set host = '%' where user = 'root'; FLUSH PRIVILEGES;

    Note: you can specify any remote address. To ensure data security, we recommend that you set a value based on your needs.

Application scope

  • Data Management