Matomo installation - No route to host

I am installing matomo using separate website for web and database. I am getting the following error from the database setup page (in the installation steps):
“Error while trying to connect to the database server: SQLSTATE[HY000] [2002] No route to host”

What should I do to fix this error?


Can you, from the machine where Matomo is installed, access the database with the credentials provided in the php.ini file?

Thank you for your feedback. Eventually, the problem was that even though the firewall was listening on the ports I needed, those ports were not open. Once I opened the ports on the database server, everything worked.