SQLSTATE[HY000] [2002] Connection refused

Recently I had a problem while using my code hosted on infinityfree and it’s using external MySQL db on Aiven.

Each time I tried to connect to db I got:
SQLSTATE[HY000] [2002] Connection refused

No matter what I tried, same error always, but on different hosting it’s connecting to Aiven DB correctly.

I’m sure no IP filtering is being used on Aiven side.

Could anyone assist me?

Please read this thread

6 Likes

I seem to remember another user having problems with avian because it didn’t use a standard SQL port… But I might be misremembering

3 Likes

Now I understand why :slightly_frowning_face:

Yes, unfortunately it’s because of custom port numbers