# Databases connection error

**URL:** <https://forum.infinityfree.com/t/databases-connection-error/41370>\
**Category:** Hosting Support\
**Created:** [February 4, 2021, 4:54pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370 "2021-02-04T16:54:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 4:54pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/1 "2021-02-04T16:54:52Z")

</div>

### Username is epiz\_2783421

### Access denied for user ‘epiz\_27834217’@‘192.168.2.194’ (using password: YES)

I made a connection using the host name, username, and password to my databases. In localhost it worked well but here I am getting error message Access denied for user ‘epiz\_\*\*\*\*\*\*\*\*’@‘192.168.2.194’ (using password: YES) what could be the exact problem. The password is correct, the username is correct, host name is also correct. Please help am new to web development please share the FULL error message

---

<div class="post-metadata">

**Author:** ![Thewebuser22](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/thewebuser22/32/25592_2.png) [@Thewebuser22](https://forum.infinityfree.com/u/Thewebuser22)\
**Post date:** [February 4, 2021, 4:59pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/2 "2021-02-04T16:59:31Z")

</div>

Did you make sure all the credentials match the ones from your account client area?

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [February 4, 2021, 5:22pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/3 "2021-02-04T17:22:07Z")

</div>

> [@Emmatruth](#):
>
> @‘192.168.2.194

this is your local host name and will cause an issue, you will need to replace this with your infinityfree host name

check here [How to setup a new MySQL Database - Docs - InfinityFree Forum](https://support.infinityfree.net/mysql/how-to-setup-a-new-mysql-database/) for more information

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 5:46pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/4 "2021-02-04T17:46:25Z")

</div>

They did match. Only that I didn’t include the database name in my config script intentending to do when I need a specific databases to use using the sqli\_select\_db

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [February 4, 2021, 5:48pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/5 "2021-02-04T17:48:43Z")

</div>

well thats great news, so its all sorted now

I wasnt any help lol but im glad you found the issue 🙂

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 5:49pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/6 "2021-02-04T17:49:05Z")

</div>

Yeah the did. Should I post my config.php script?

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [February 4, 2021, 5:49pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/7 "2021-02-04T17:49:51Z")

</div>

you can post anything you like here but just make sure you **dont include the password** 😛

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 5:53pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/8 "2021-02-04T17:53:26Z")

</div>

You really were of help. Without the direction I wouldn’t have come to know what I did

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [February 4, 2021, 5:56pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/9 "2021-02-04T17:56:45Z")

</div>

no problem , im no expert for sure but I try to help where I can.

my business is dead right now with the lockdown mess so I have a bit of spare time on my hands and thought I would put it to good use helping out here

infinityfree have been so kind to give me free hosting and help me out when ive had issues that its only fair I try to return the love

thanks

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 5:59pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/10 "2021-02-04T17:59:58Z")

</div>

\<?php $servername = "sql306.epizy.com"; $username = "epiz\_27834217"; $password = "\*\*\*\*\*\*\*\*\*\*"; // Create connection $conn = new mysqli($servername, $username, $password); // Check connection if ($conn-\>connect\_error) { die("Connection failed: " . $conn-\>connect\_error); } $mess= "Connected successfully"; ?\>

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [February 4, 2021, 6:02pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/11 "2021-02-04T18:02:15Z")

</div>

heh im just off to learn mysql so I can understand that 😃

btw if you highlight your code in the message editor and then click the preformatted text icon in the message editor top bar it’ll display nicely like this

```
<?php
$servername = "sql306.epizy.com";
$username = "epiz_27834217";
$password = " **********";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }
$mess= "Connected successfully";
?>

```

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 6:04pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/12 "2021-02-04T18:04:55Z")

</div>

Waiting for you help sir

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 6:12pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/13 "2021-02-04T18:12:08Z")

</div>

This is the code causing connection problem. What should I have done?

---

<div class="post-metadata">

**Author:** ![Oxy](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/oxy/32/37989_2.png) [@Oxy](https://forum.infinityfree.com/u/Oxy)\
**Post date:** [February 4, 2021, 6:14pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/14 "2021-02-04T18:14:35Z")

</div>

you miss` database name` for conn.

> **[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...

 ![image](https://forum-cdn.infinityfree.net/original/2X/4/41031b744333aa39cbab84cbc928cb64946fbcb1.png)

you need 4 parameters

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 6:16pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/15 "2021-02-04T18:16:16Z")

</div>

What I actually meen is that when testing this code on localhost with user root, password root it worked well but here it is not

---

<div class="post-metadata">

**Author:** ![lovebug](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lovebug/32/57624_2.png) [@lovebug](https://forum.infinityfree.com/u/lovebug)\
**Post date:** [February 4, 2021, 6:21pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/16 "2021-02-04T18:21:45Z")

</div>

thanks oxydac you beat me to it 😃

I was just checking here [PHP: mysqli::\_\_construct - Manual](https://www.php.net/manual/en/mysqli.construct.php) and noticed that

**" dbname If provided will specify the default database to be used when performing queries."**

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 6:33pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/17 "2021-02-04T18:33:04Z")

</div>

Thanks for your help I got the point clearly now

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 6:37pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/18 "2021-02-04T18:37:30Z")

</div>

Thanks for you help

---

<div class="post-metadata">

**Author:** ![Oxy](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/oxy/32/37989_2.png) [@Oxy](https://forum.infinityfree.com/u/Oxy)\
**Post date:** [February 4, 2021, 6:49pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/19 "2021-02-04T18:49:40Z")

</div>

YW, good luck in further work

---

<div class="post-metadata">

**Author:** ![Emmatruth](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/emmatruth/32/13437_2.png) [@Emmatruth](https://forum.infinityfree.com/u/Emmatruth)\
**Post date:** [February 4, 2021, 6:53pm UTC](https://forum.infinityfree.com/t/databases-connection-error/41370/20 "2021-02-04T18:53:53Z")

</div>

Welcome

[Next page](https://forum.infinityfree.com/t/databases-connection-error/41370.md?page=2)
