Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look.
Can you paste the MySQL hostname exactly as your control panel lists it under MySQL Databases? Can you also share the lines of your PHP code that build the connection, with the password removed? I’d like to see the host value and whether a port is set. Your post gives the host a few different ways (sql305.infinityfree, sql305.infinityfree.com, sql305.byetcluster). I can’t tell from that which one your code actually uses.
The knowledge base says the hostname has to be used exactly as listed under Current Databases, and that localhost won’t work on InfinityFree. It also says a connection error that doesn’t say much usually comes from the details your software passes, so the exact code is the quickest way to narrow it down:
The forum topics I found with the same “Connection refused” error were mostly scripts pointing at a database somewhere else (an external Aiven database, for instance). Yours doesn’t look like that, so I wouldn’t assume it’s the same cause. I found nothing that says what “Connection refused” means from an InfinityFree database server itself. If the hostname and code both match what the control panel shows, a person would need to look at the server side.