Sql database access denied

Please my html files in the ftp say there’s access denied to my sql db.Please help me

access denied means the connection has invalid password. is the password same with your cpanel?

or have you changed your password

1 Like

Please also read this:

okay i solved that but now it’s saying,no such file or directory

From the same article I posted:

The message No such file or directory is shown when you’re trying to use localhost as your database hostname. Using localhost means your script will look for the database on the same server as your website, which will not work on InfinityFree.

The database hostname should look like sql123.epizy.com, but the exact value depends on your account. You can find your database hostname in your control panel under MySQL Databases.

sorry for the late reply,my connection variable in my php points to the sql hostname sql103.epizy.com

I suggest you define the connection details in different variables, for example:

define("DBHOST", "your database host");
define("DBUSER", "your database username");
define("DBPASS", "your database password");
define("DBNAME", "your database name");

and then connect to the database by creating a variable called $conn that equals to calling mysqli_connect or calling a new mysqli object with the defined variables DBHOST, DBUSER, DBPASS and DBNAME. So you know easily what database details are to be inserted, and not commit any errors while inserting them.

I’ll try that but do i have to grant some privilege to the db using the sql commands since the phpmyadmin of xampp doesnt require that much given its simple interface in granting user privelege

You don’t need to grant any priviledge on the database for the user, seen that the user can access all databases created from the “MySQL Databases” section of the Control Panel.

oh okay im defining the connection variables,ill get back to you thanks for the response

1 Like

okay i just defined them but its still saying no such file or directory

What is your website URL?

http://willies.rf.gd/willies/home.php

And what is the code you used to connect to the database?

willies.rf.gd/willies/includes/db.php or you want me to paste the whole code?

I want you to paste the whole code, because like so I can’t see it.

sql1O3.epizy.com is not the correct database host; the O is a 0, according to me!
And don’t share the password to anyone! Change it to something else, before they can access your account or things without the permissions, but don’t use the password you now have leaked!

thanks i did that but im getting the same error,

I didn’t see you did that, according to my visits. sql1O3.epizy.com is NOT sql103.epizy.com!

yes please, i changed it too 103