MySQL Connection timed out (SQLSTATE[HY000] [2002]) — works via phpMyAdmin but not via PHP

Website URL

mariagealeksandraetyann.rf.gd

Error Message

Username: if0_42777391

Error Message: SQLSTATE[HY000] [2002] Connection timed out

Other Information

I’m getting an intermittent “Connection timed out” error when my PHP scripts
try to connect to my MySQL database (host: sql202.infinityfree.com,
database: if0_42777391_db_mariage).

The connection works fine through phpMyAdmin (I can view and export my
tables without any issue), but PDO connections from my PHP scripts on the
same account time out with SQLSTATE[HY000] [2002].

The site worked correctly a few days ago (I have a successful database
insert from 2026-08-29), so this seems to be a recent/intermittent issue
rather than a configuration problem on my end. I’ve double-checked my
DB_HOST, DB_NAME, DB_USER and DB_PASS values and they match exactly what’s
shown in the MySQL Databases panel.

This is for a wedding website with a live RSVP form, so a working database
connection is important for me. Could someone please take a look at
whether there’s a known issue with sql202.infinityfree.com, or check my
account for anything unusual (e.g. connection limits)?

Thank you very much for your help!

Can you share the code you are using? Make sure to remove the password, but you can keep the other values.