# Authentication issue

**URL:** https://forum.infinityfree.com/t/authentication-issue/121161
**Category:** Hosting Support
**Created:** [October 8, 2026, 11:08am UTC](https://forum.infinityfree.com/t/authentication-issue/121161 "2026-10-08T11:08:33Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Genuine](https://forum.infinityfree.com/letter_avatar/genuine/32/5_5575768a8748004e209b776fc1b2916d.png) [@Genuine](https://forum.infinityfree.com/u/Genuine)
#### Post date: [October 8, 2026, 11:08am UTC](https://forum.infinityfree.com/t/authentication-issue/121161/1 "2026-10-08T11:08:33Z")

</div>

### Website URL

[https://izina3link.wuaze.com](https://izina3link.wuaze.com)

### Error Message

Hosting account: if0\_43113193  
MySQL host: sql305.infinityfree  
Database: if0\_43113193\_izinaerp  
Database username: if0\_43113193  
My PHP application cannot connect to MySQL.  
The exact error is:  
SQLSTATE[HY000] [2002] Connection refused  
I verified the following:

- The database exists and is accessible through phpMyAdmin.
- The database tables and data are present.
- The PHP application is hosted inside the same InfinityFree hosting account.
- The database hostname, database name, and username match the values shown in the InfinityFree control panel.
- I tested both [sql305.infinityfree.com](http://sql305.infinityfree.com) and sql305.byetcluster
- Both return Connection refused.
- This is not an Access denied or wrong-password error.  
Could you please check whether hosting account if0\_43113193 can connect internally to MySQL server sql305, and whether there is a database networking/firewall/backend issue affecting this account?

### Other Information

[sql305.infinityfree.com](http://sql305.infinityfree.com)

---

<div class="post-metadata">

### Author: ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)
#### Post date: [October 8, 2026, 11:08am UTC](https://forum.infinityfree.com/t/authentication-issue/121161/2 "2026-10-08T11:08:33Z")

</div>

Welcome to the InfinityFree community forum! Good to have you here.

- Most people answering here are volunteers. They’re often the fastest source of help. Admin (the only staff member) checks in about once a day for issues on our end.
- Volunteers can’t see your account or website. Share what you actually see, like error messages and what happens when you try something. That’s more useful than your theory of what’s wrong.
- AI tools often get InfinityFree wrong. If a volunteer’s advice differs from what an AI told you, please try the volunteer’s suggestion first.
- Solving an issue is a joint effort. Try the suggestions you get and report back what happened.

---

<div class="post-metadata">

### Author: ![InfinityFreeBot](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/infinityfreebot/32/3715_2.png) [@InfinityFreeBot](https://forum.infinityfree.com/u/InfinityFreeBot)
#### Post date: [October 8, 2026, 11:08am UTC](https://forum.infinityfree.com/t/authentication-issue/121161/3 "2026-10-08T11:08:51Z")

</div>

_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:

> [@How to connect with MySQL](https://forum.infinityfree.com/docs?topic=49340):
>
> Both the popular PDO and MySQLi libraries are available on all accounts and PHP versions, which are the libraries all (modern) scripts use to connect to a MySQL database. However, to use a database, you need to configure a few things first. Before you can use a database, you need to create the database first. You can create a database through your control panel in the section called MySQL Databases. Simply enter a desired name in the text box and click Create Database. To use the database with…

> [@Common MySQL Connection Errors](https://forum.infinityfree.com/docs?topic=49338):
>
> Many websites use MySQL databases to store information and settings. However, there are some reasons why the connection to the database may fail. This article describes some commonly seen error messages when connecting to a database, as well as some general tips to keep in mind when setting up a database connection. Common Error Messages Using MySQL is great, but the error message returned if there is an issue logging in to your database can be quite confusing. Here are some commonly seen error…

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.

---

<div class="post-metadata">

### Author: ![Genuine](https://forum.infinityfree.com/letter_avatar/genuine/32/5_5575768a8748004e209b776fc1b2916d.png) [@Genuine](https://forum.infinityfree.com/u/Genuine)
#### Post date: [October 8, 2026, 11:19am UTC](https://forum.infinityfree.com/t/authentication-issue/121161/4 "2026-10-08T11:19:44Z")

</div>

The MySQL hostname shown in my InfinityFree control panel under **MySQL Databases** is:

```auto
sql305.infinityfree.com

```

My current `.env` configuration is:

```auto
DB_HOST=sql305.infinityfree.com
DB_PORT=3306
DB_NAME=if0_43113193_izinaerp
DB_USER=if0_43113193
DB_PASSWORD=

```

The application uses PDO. The database connection is built in `_private/src/Bootstrap.php` like this:

```auto
function db(): PDO {
    static $pdo = null;

    if (!$pdo) {
        $dsn = sprintf(
            'mysql:host=%s;port=%d;dbname=%s;charset=utf8mb4',
            config('DB_HOST', '127.0.0.1'),
            (int) config('DB_PORT', '3306'),
            config('DB_NAME', 'izina_erp_v1')
        );

        $pdo = new PDO(
            $dsn,
            config('DB_USER'),
            config('DB_PASSWORD'),
            [
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
                PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
                PDO::ATTR_EMULATE_PREPARES => false
            ]
        );
    }

    return $pdo;
}

```

So the resulting DSN is effectively:

```auto
mysql:host=sql305.infinityfree.com;port=3306;dbname=if0_43113193_izinaerp;charset=utf8mb4

```

I also created a minimal PDO connection test on the same InfinityFree hosting account. It returned:

```auto
SQLSTATE[HY000] [2002] Connection refused

```

---

<div class="post-metadata">

### Author: ![dan3008](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/dan3008/32/53336_2.png) [@dan3008](https://forum.infinityfree.com/u/dan3008)
#### Post date: [October 8, 2026, 12:26pm UTC](https://forum.infinityfree.com/t/authentication-issue/121161/5 "2026-10-08T12:26:13Z")

</div>

Welcome to the forum. Just checking, because I’m not 100% confident on the code, your not trying to connect to the database on 127.0.0.1 are you? Because that won’t work.

I may be totally off base here, so if I’m wrong, please feel free to disregard the above

---

<div class="post-metadata">

### Author: ![Meishin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/meishin/32/59902_2.png) [@Meishin](https://forum.infinityfree.com/u/Meishin)
#### Post date: [October 8, 2026, 12:39pm UTC](https://forum.infinityfree.com/t/authentication-issue/121161/6 "2026-10-08T12:39:50Z")

</div>

My guess is that `config()` did not actually got values from your `.env` file, and is falling back to default values.

Try to make the code actually print the DSN out to see if it is wrong, not the “effectively something” you may have guessed.
