# I can't link my database

**URL:** <https://forum.infinityfree.com/t/i-cant-link-my-database/93941>\
**Category:** Hosting Support\
**Created:** [May 23, 2024, 3:00am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941 "2024-05-23T03:00:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![N0V3L0S](https://forum.infinityfree.com/letter_avatar/n0v3l0s/32/6_22734026db12803ebb3e059622ac3534.png) [@N0V3L0S](https://forum.infinityfree.com/u/N0V3L0S)\
**Post date:** [May 23, 2024, 3:00am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941/1 "2024-05-23T03:00:56Z")

</div>

The truth is I don’t know what’s happening now, I’ve previously managed to connect my page to the database, but now it won’t let me, I’ve already tried changing some things in the account and so on, but I can’t connect, I get the following error, no I know if it works for you, but even so I made sure I had the name of the database and those details right, but it still fails

**Warning** : mysqli\_connect(): php\_network\_getaddresses: getaddrinfo for [sql301.infinityfree.com](http://sql301.infinityfree.com) failed: Host desconocido. in **C:\Users\User\Desktop\pagina web final\php\conexion\_be.php** on line **5**

**Fatal error** : Uncaught mysqli\_sql\_exception: php\_network\_getaddresses: getaddrinfo for [sql301.infinityfree.com](http://sql301.infinityfree.com) failed: Host desconocido. in C:\Users\User\Desktop\pagina web final\php\conexion\_be.php:5 Stack trace: #0 C:\Users\User\Desktop\pagina web final\php\conexion\_be.php(5): mysqli\_connect(‘sql301.infinity…’, ‘if0\_35906114’, Object(SensitiveParameterValue), ‘if0\_36597932\_us…’) #1 {main} thrown in **C:\Users\User\Desktop\pagina web final\php\conexion\_be.php** on line **5**

---

<div class="post-metadata">

**Author:** ![KangJL](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/kangjl/32/12130_2.png) [@KangJL](https://forum.infinityfree.com/u/KangJL)\
**Post date:** [May 23, 2024, 3:53am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941/2 "2024-05-23T03:53:05Z")

</div>

This is expected

> [@Connecting to MySQL from an external application](https://forum.infinityfree.com/t/connecting-to-mysql-from-an-external-application/49339/1):
>
> Sometimes, you may want to connect to your MySQL database on your free hosting account using external software, like a desktop database manager (like MySQL Workbench) or an external program you wrote yourself (like an Android or iOS app). You cannot connect to a free hosting MySQL database from outside your hosting account. You can only interact with your free hosting database through PHP scripts uploaded to your free hosting account, or through our phpMyAdmin installation. The ability to con…

---

<div class="post-metadata">

**Author:** ![N0V3L0S](https://forum.infinityfree.com/letter_avatar/n0v3l0s/32/6_22734026db12803ebb3e059622ac3534.png) [@N0V3L0S](https://forum.infinityfree.com/u/N0V3L0S)\
**Post date:** [May 23, 2024, 3:58am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941/3 "2024-05-23T03:58:28Z")

</div>

This is the second website that I am creating, in the previous one everything worked well, this current one is the one that has problems and I have done everything the same, that is why I am destined to ask

---

<div class="post-metadata">

**Author:** ![KangJL](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/kangjl/32/12130_2.png) [@KangJL](https://forum.infinityfree.com/u/KangJL)\
**Post date:** [May 23, 2024, 4:30am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941/4 "2024-05-23T04:30:54Z")

</div>

> [@N0V3L0S](#):
>
> I have done everything the same

No, definitely different.  
Database on free hosting can only be connected through hosting account.

> [@N0V3L0S](#):
>
> C:\Users\User\Desktop\pagina web final\php\conexion\_be.php

is definitely not

---

<div class="post-metadata">

**Author:** ![N0V3L0S](https://forum.infinityfree.com/letter_avatar/n0v3l0s/32/6_22734026db12803ebb3e059622ac3534.png) [@N0V3L0S](https://forum.infinityfree.com/u/N0V3L0S)\
**Post date:** [May 23, 2024, 5:09am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941/5 "2024-05-23T05:09:02Z")

</div>

**Warning** : mysqli\_connect(): php\_network\_getaddresses: getaddrinfo for [sql301.infinityfree.com](http://sql301.infinityfree.com) failed: Name or service not known in **/home/vol17\_1/infinityfree.com/if0\_36597932/htdocs/php/conexion\_be.php** on line **5**

**Fatal error** : Uncaught mysqli\_sql\_exception: php\_network\_getaddresses: getaddrinfo for [sql301.infinityfree.com](http://sql301.infinityfree.com) failed: Name or service not known in /home/vol17\_1/infinityfree.com/if0\_36597932/htdocs/php/conexion\_be.php:5 Stack trace: #0 /home/vol17\_1/infinityfree.com/if0\_36597932/htdocs/php/conexion\_be.php(5): mysqli\_connect(‘\tsql301.infinit…’, ‘if0\_36597932’, Object(SensitiveParameterValue), ‘if0\_36597932\_pr…’) #1 /home/vol17\_1/infinityfree.com/if0\_36597932/htdocs/php/registro\_usuario\_be.php(3): include(‘/home/vol17\_1/i…’) #2 {main} thrown in **/home/vol17\_1/infinityfree.com/if0\_36597932/htdocs/php/conexion\_be.php** on line **5**

---

<div class="post-metadata">

**Author:** ![KangJL](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/kangjl/32/12130_2.png) [@KangJL](https://forum.infinityfree.com/u/KangJL)\
**Post date:** [May 23, 2024, 5:18am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941/6 "2024-05-23T05:18:37Z")

</div>

Read on

> [@Common MySQL Connection Errors](https://forum.infinityfree.com/t/common-mysql-connection-errors/49338/1):
>
> 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…

---

<div class="post-metadata">

**Author:** ![N0V3L0S](https://forum.infinityfree.com/letter_avatar/n0v3l0s/32/6_22734026db12803ebb3e059622ac3534.png) [@N0V3L0S](https://forum.infinityfree.com/u/N0V3L0S)\
**Post date:** [May 23, 2024, 5:45am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941/7 "2024-05-23T05:45:44Z")

</div>

I don’t speak English, I speak Spanish, that’s why it’s more of a problem hahaha

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [May 23, 2024, 7:05am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941/8 "2024-05-23T07:05:25Z")

</div>

I checked the specific file, and this is how you have set the hostname:

![image](https://forum-cdn.infinityfree.net/original/3X/b/5/b535ae1b718dc88c00fab9e5fc7c7daeaabda3ad.png)

There is a lot of extra whitespace between the starting quotes and the actual hostname. And yes: that matters. It changes the hostname and results in a different value that does not work.

Please make sure to use the exact values provided to you, configured in exactly that way. Even seemingly insignificant changes can break it.

---

<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:** [May 30, 2024, 7:06am UTC](https://forum.infinityfree.com/t/i-cant-link-my-database/93941/9 "2024-05-30T07:06:06Z")

</div>

Closed on May 30, 2024, 7:06am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
