Fixing "Connection Refused" Errors When Connecting to your database

When connecting your website or application to your Managed Database Hosting, you may sometimes encounter a “Connection Refused” error.

This happens when your application tries to reach the database, but the server rejects the connection. Below are the common reasons and their solutions.

1. Access Restrictions

For security, databases only allow connections from approved IP addresses. If your hosting server’s IP is not authorized, the connection will be refused.

How to Fix the Issue

Option A : Whitelist Your Hosting Server IP

- Find your hosting server’s IP address.
Open a support ticket with Provider.lk and request to whitelist the IP.
Once approved, your hosting will be able to connect to the database.

Option B: Enable Wildcard IP Access

- If your hosting IP changes often or you don’t have a fixed IP, request wildcard IP support.
Wildcard allows connections from any IP.
For security reasons, your database password will be reset to a stronger one.
Use this new password to connect.
- If wildcard access is enabled, update your app with the new database password.

2. Configuration Problems

Incorrect database settings in your application can block the connection. Examples include using the wrong host, port, or database name, having the database listen only on localhost instead of allowing external connections.

How to Fix the Issue

- Check and correct the host, port, database name, username, and password.
- Ensure the database allows external connections.

3. Authentication & Permissions

Invalid database credentials or insufficient user privileges can block the connection.

How to Fix the Issue

- Double-check the database username and password.
- Ensure the user has remote access privileges.
- If the password was reset due to wildcard access, update your application with the new credentials.

Following these steps will help resolve most “Connection Refused” errors and restore your database connection.

  • 0 Els usuaris han Trobat Això Útil
Ha estat útil la resposta?

Articles Relacionats

Getting Started with Managed Database Hosting at Provider.lk

When you purchase a Managed Database Hosting package from Provider.lk, your database is created...

Importing and Exporting Databases with phpMyAdmin

One of the first things you may need to do after setting up your Managed Database Hosting with...

How to Improve Database Performance?

A well-designed database not only reduces server load but also makes your website or application...