SQL303 connection refused from PHP, but phpMyAdmin works

Website URL

https://kentechx.com

Error Message

Website URL:
https://kentechx.com

Hosting account:
if0_42532881

Database server:
sql303.infinityfree.com

Error:
mysqli_sql_exception: Connection refused

I created the database through VistaPanel and successfully imported it through phpMyAdmin. phpMyAdmin can access the database, but PHP scripts hosted on the same InfinityFree account cannot connect.

I tested both:
sql303.infinityfree.com
sql303.byetcluster.com

Both return “Connection refused.” The database username, database name, hosting password and port 3306 have been checked.

Could you please check whether SQL server sql303 or my hosting account’s database access has a network/firewall problem?

Thank you. I followed the troubleshooting article and verified the following:

  • The database hostname is exactly sql303.infinityfree.com.
  • I also tested sql303.byetcluster.com.
  • The full database name is if0_42532881_portfolio.
  • The database username is if0_42532881.
  • I copied the hosting account password directly from Account Details, not my Client Area password.
  • The PHP application is hosted inside the same InfinityFree account.
  • The database exists, and phpMyAdmin can access it successfully.

I temporarily enabled mysqli exception output. The complete error from PHP is:

mysqli_sql_exception: Connection refused

This is not “Access denied” or “No such file or directory.” Could you please check whether web hosting account if0_42532881 can reach SQL server sql303 internally?

This is a community forum. We cannot check that. But of you couldn’t is expect the phpmyadmin to have problems.

Remember your sql password and your account password may be deferent.

Make sure you’re cooling the sql password from this page (it’s the database details page)

Id suggest not using the copy button as that seems to sometimes add an extra space on the end

I copied the separate MySQL password directly from the MySQL Connection Details page and updated the application. The error remains:

mysqli_sql_exception: Connection refused

All connection details now exactly match the MySQL Databases page. Could this be a problem with SQL303 accepting connections from my hosting volume?

Unlikely. If this were the case it’s likely that everyone on sql303 would be experiencing it.

And the status page shows no process with the sql server.

Can I check where you’re setting the error because your site looks to be working to me

Please be aware that the status page is partially populated by what I can monitor myself from the outside, and partially based on user reports. Monitoring the database servers remotely is not possible, so I would need someone to see an issue and me to confirm it so I can put up a message on the status page.

But a Connection Refused error is odd. That’s not an authentication issue, it’s a connection issue, so either you’re using the wrong hostname or something is wrong inside the platform. But if phpMyAdmin works, it also means the database is up, which makes it more confusing.