'SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for endpoint failed in RDS

I am getting this error when running php artisan migrate:fresh --seed from a aws farget contaner. I am using aws RDS, i have read and try a lot of solutions that i have read from the internet but nothing seems to work.

From the farget container, i was able to connect to the RDS database using mysql client from port 3306 which i have enable it from my security group. I have run out of options here, i don't know what i did wrong.

Here is the full error SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo for endpoint failed: Name does not resolve (SQL: select * from information_schema.tables where table_schema = db and table_name = migrations and table_type = 'BASE TABLE')



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source