Databases connection error

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

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

1 Like

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 for more information

2 Likes

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

1 Like

well thats great news, so its all sorted now

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

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

you can post anything you like here but just make sure you dont include the password :stuck_out_tongue:

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

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

2 Likes
<?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"; ?>

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

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";
?>

Waiting for you help sir

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

you miss database name for conn.

you need 4 parameters

5 Likes

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

thanks oxydac you beat me to it :smiley:

I was just checking here PHP: mysqli::__construct - Manual and noticed that

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

4 Likes

Thanks for your help I got the point clearly now

Thanks for you help

YW, good luck in further work

1 Like

Welcome

1 Like