Home  >  Article  >  Operation and Maintenance  >  How to handle the problem of database connection failure after using Ubuntu system ECS script

How to handle the problem of database connection failure after using Ubuntu system ECS script

坏嘻嘻
坏嘻嘻forward
2018-09-30 15:18:222795browse

The content of this article is about how to deal with the database connection failure after using the script in Ubuntu system ECS. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Ubuntu system ECS cannot be remotely connected and the database cannot be connected after using the "How to restrict external scanning behavior through firewall policy" script

Ubuntu system After ECS uses the script in "How to restrict external scanning behavior through firewall policies" for security protection, the system cannot be remotely connected or the database cannot be connected. This is because the script restricts external data packet requests. Follow the following operations according to the port you actually use. The situation can be repaired:

1. First look at the current rules. There is no port 22 allowed in the inbound direction.

How to handle the problem of database connection failure after using Ubuntu system ECS script

##2. Add ssh in the incoming direction , after adding, the test can be connected (the same is true for 3306, etc.)

Execute command:

ufw allow 22

How to handle the problem of database connection failure after using Ubuntu system ECS script

#3. Ping the domain name prompts unkonwn host, and you need to add domain name resolution rules.

Execute the command: ufw insert 1 allow out 53/udp (Why is it different from the above addition rule? First, the out chain already has rules. This allowed rule needs to be added to the top, so use insert 1 means to be added in front of the first item, and the following means to allow the udp protocol for the outbound direction of port 53).

How to handle the problem of database connection failure after using Ubuntu system ECS script

How to handle the problem of database connection failure after using Ubuntu system ECS script

The above is the detailed content of How to handle the problem of database connection failure after using Ubuntu system ECS script. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:aliyun.com. If there is any infringement, please contact admin@php.cn delete