This topic may contain information about third-party tools. The information is only for reference. Alibaba Cloud does not guarantee or make commitments to the performance and reliability of third-party tools, or the potential impacts of operations on the tools.
Problem description
The system prompts the following error when you add a self-managed MySQL database to Data Management (DMS).
null,message from server:"Host 'x.x.x.x' is not allowed to connect to this MySQL server"Cause
The IP address of DMS is unauthorized in the self-managed MySQL database.
Solution
Before you perform high-risk operations, such as modifying the configurations or data of an instance, we recommend that you check the disaster recovery and fault tolerance capabilities of the instance to ensure the security of your data.
Before you modify the configurations or data of an instance, such as an Elastic Compute Service (ECS) instance or an RDS instance, we recommend that you create snapshots or enable backup for the instance. For example, you can enable the log backup feature for an RDS instance.
If you granted permissions on sensitive information or submitted sensitive information, such as usernames and passwords, in the Alibaba Cloud Management Console, we recommend that you modify the sensitive information at the earliest opportunity.
You need to authorize the IP address of DMS in the self-managed MySQL database and then log on to the self-managed MySQL database again. You can select one of the following solutions based on the actual situation:
Solution 1: Authorize a specific IP address to log on to the self-managed MySQL database. In this example, the denied IP address is authorized. Procedures:
NoteThe IP address of DMS is changed on a regular basis, this solution is suitable only for a specific IP address of DMS. If you need to use DMS to log on to a self-managed MySQL database for a long period of time, use the second solution.
Record the IP address in the error message.
Log on to the self-managed MySQL database. Execute the following SQL statement to authorize the denied IP address in self-managed MySQL database:
GRANT ALL PRIVILEGES ON *.* TO '[$DB_User]'@'[$Host]' IDENTIFIED BY '[$DB_Pass]' WITH GRANT OPTION;Note[$DB_User]: the username that is used to log on to the self-managed MySQL database.
[$Host]: the IP address in the error message.
[$DB_Pass]: the password that is used to log on to the self-managed MySQL database.
The preceding statement is for reference only. The specific information, such as permissions, database name, username, and IP address, is based on the actual situation.
Execute the following SQL statement to refresh the permissions:
FLUSH PRIVILEGES;Add the self-managed MySQL database to DMS and log on to the database again.
Solution 2: Authorize all IP addresses to log on to the self-managed MySQL database. Procedures:
NoteThis solution allows you to use all IP addresses to log on to the self-managed MySQL database, which may pose security risks. Proceed with caution.
Log on to the self-managed MySQL database. Execute the following SQL statement to authorize all IP addresses to log on to the self-managed MySQL database.
GRANT ALL PRIVILEGES ON *.* TO '[$DB_User]'@'%' IDENTIFIED BY '[$DB_Pass]' WITH GRANT OPTION;Execute the following SQL statement to refresh the permissions:
FLUSH PRIVILEGES;Add the self-managed MySQL database to DMS and log on to the database again.
Applicable service
DMS