A MySQL "Connection refused" error on shared hosting almost always means one of two things: your website's code is using the wrong database host, or you are trying to reach the database from outside the server, where port 3306 is closed. For code running on your hosting account, the fix is to use localhost as the host. For desktop tools, use phpMyAdmin or an SSH tunnel.
Our main guide, Database troubleshooting, covers every common database error on Domain India hosting: access denied, too many connections, crashed tables, imports and character sets. This page is the short version for "Connection refused".
If your website shows "Connection refused" or SQLSTATE[HY000] [2002], set the database host to localhost in its config file, and check the database name, user and password, which all carry your account prefix. If a desktop tool such as MySQL Workbench can't connect, that is expected: port 3306 is closed to outside connections on our shared servers, so use phpMyAdmin, or an SSH tunnel once support has enabled jailed SSH on your account.
1. From your website: use localhost
Your website and its database are on the same hosting server, so the connection should stay on that server. If your config file names your domain, the server's IP address or a remote hostname as the database host, the connection goes out to the network and is refused or times out.
- Open your config file.For WordPress that is
wp-config.php; for Laravel,.env; for custom PHP, the file that opens the connection. Use the File Manager if you don't use FTP. - Set the host to localhost.In WordPress:
define( 'DB_HOST', 'localhost' );. In PHP:new mysqli('localhost', 'acme_shopuser', 'password', 'acme_shop');. - Check the other three values.The database name and user include your account prefix, for example
acme_shop, and the password is the database user's password, not your control panel password. - Reload the site.If the error changes to "Access denied", the host is now right and the problem is the user or password; see Database troubleshooting, section 3.
After a migration, check all four values again: the account prefix usually changes with the new username.
2. From your own computer: port 3306 is closed
Desktop tools such as MySQL Workbench, DBeaver or HeidiSQL can't connect to your database directly. Port 3306 is closed to outside connections on our shared servers (measured September 2026), so a direct connection is refused or times out.
cPanel's Remote Database Access page and DirectAdmin's access hosts only tell the database which addresses may log in. They don't open port 3306 in the server firewall, so a direct connection still fails. Use one of the two options below.
- phpMyAdmin in your control panel works on every plan and needs no setup.
- An SSH tunnel carries the database connection inside an encrypted SSH login. Jailed SSH access is available on every shared hosting plan (cPanel, DirectAdmin, Webuzo). It is off by default; ask support to enable it for your account. SSH login uses a key, not a password, so add your public key first; see enabling and accessing jailed SSH. Then run:
ssh -N -L 3307:localhost:3306 [email protected]Leave that window open and point your tool at host 127.0.0.1, port 3307, with your usual database name, user and password. The full walk-through, including PuTTY and SSH keys, is in securing MySQL access with SSH tunnels.
3. Still refused?
- Several sites fail at once with correct settings: the database service may have a problem. Open a support ticket with the exact error and the time it started.
- The app is on a different server from the database, such as a VPS or another host: shared hosting databases can't serve it directly. Move the database next to the app, or tunnel as above for occasional access.
- Windows (Plesk) hosting plans come with Microsoft SQL Server databases, and Windows hosting has no SSH, so the tunnel above doesn't apply there. See creating an MSSQL database in Plesk.
Frequently asked questions
What database host should I use on Domain India shared hosting?
Use localhost for any website or application running on the same hosting account as the database. Your domain name or the server IP address makes the connection go out to the network, where it is refused or times out.
Why does MySQL Workbench say connection refused or time out?
Port 3306 is closed to outside connections on Domain India shared servers, so desktop tools can't connect directly. Use phpMyAdmin in your control panel, or an SSH tunnel once support has enabled jailed SSH on your account.
I added my IP address in Remote Database Access. Why can't I connect?
The Remote Database Access list only controls which addresses the database accepts logins from. It does not open port 3306 in the server firewall, so direct connections from outside still fail. Use an SSH tunnel or phpMyAdmin instead.
Is SSH available on shared hosting for a tunnel?
Yes. Jailed SSH access is available on every Domain India shared hosting plan (cPanel, DirectAdmin, Webuzo). It is off by default, so ask support by live chat or ticket to enable it for your account. You log in with an SSH key, not a password.
Ready to fix it? Check your settings with how to connect to the MySQL database, work through Database troubleshooting, or open a ticket to ask for SSH access.
Send us the exact error, the database name and when it started. Never include your database password.
Open a support ticket