I am moving a running site from staging to production. The production environment has 2 servers, one for frontend and the other for the database.
The issue is when I try to browse the website, I get this error
PDOException SQLSTATE[HY000]  Permission denied in [ROOT]/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php on line 79
The real problem is I am sure that the database connection is set right. Permissions and ports are set right.
I tried the same database connection info from an external PHP file on the same server and I got successfully connected.
Also, I tried
drush st and it told me that database status is Connected, and Drupal bootstrap status is Success.
drush sqlc and I got connected to the remote database. I can list tables, execute queries, etc.
Any ideas what might be the problem?