Cannot connect to MySQL database - access denied error

Website URL

(http://usp2022.epizy.com/sup25/)

Error Message

(SQLSTATE[HY000] [1045] Access denied for user ‘epiz_31121671’@‘192.168.0.221’ (using password: YES))

Other Information

(I am trying to connect to my MySQL database for my MVC application. Here are my database settings:

  • MySQL Host: sql200.epizy.com
  • Database Name: epiz_31121671_sup25_sa
  • MySQL Username: epiz_31121671
  • MySQL Password: (my cPanel password)

I have confirmed:

  • The database exists in phpMyAdmin
  • Tables korisnici_sa and kursevi_sa are created
  • Using PDO connection in PHP
  • Tried multiple hostnames and password variations

The application works locally but not on InfinityFree. Please check if there are any permission issues with my MySQL user account or if the password needs resetting.)

picture of the password at the account details

and my cod in config

Do not, under any circumstances, share your passwords!!!

This is a hosting support forum, and everyone can see this topic.

Change your password now!

(A moderator will come by and edit this post soon.)


Hello, and Welcome to the InfinityFree Forum @stevan.jokic!

Does the Database exist? Are all credentials correct?

5 Likes

yes everything else is in place

Are you trying to connect to your DB externally? Or are you doing this from your site?

3 Likes

Unlisted for security issue

doing for a project site for my uni

Try using this to connect to your DB (replace templates with your real credentials):

<?php

// Database configuration (Remove the brackets, fill in the information in the "")
$servername = "[Replace with DB Servername, like 100.epizy.com for example]";
$username = "[Replace with Username, like if0_00000000 for example]";
$password = "[Replace with Password]";
$dbname = "[Replace with DB name]";

// Connect to the database
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

Also, make sure to double-check your credentials, sometimes when copying the text a trailing space may be included.

(A Leader has made this topic hidden from the public, and a Moderator will come by and edit your post soon.)

3 Likes

If you have not already, change your hosting account password.

And never, under any circumstances, share any of your passwords with anyone (and especially never share it publicly).

6 Likes

Did you already check this error message in our knowledge base?

5 Likes