Website URL
http://infinitytest.infinityfreeapp.com/php/conn.php
Error Message
Connection failed: SQLSTATE[HY000] [1044] Access denied for user ‘epiz_33752893’@‘192.168.0.%’ to database ‘epiz_32752893_db1’
Other Information
I have seen someone mentioned php configuration, but I don’t know how and where to set it.
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…
You’ll need to find where in your code the connection is being form, and by having a quick look in http://infinitytest.infinityfreeapp.com/php/ without any knowledge of your code, I think it’s entirely possible it’s done in the file you linked (conn.php).
4 Likes
I tried different codes indifferent styles, but none of them was able to access the database.
<?php
$servername = "sql313.epizy.com:3306";
$username = "epiz_33752893";
$password = // password
$database = "epiz_32752893_db1";
try {
$conn = new PDO("mysql:host=$servername;dbname=$database", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
} catch(PDOException $e) {
echo "Connection failed: " . $e->getMessage();
}
// Close connection
$conn = null;
?>
Oxy
May 1, 2023, 6:10am
4
check if the DB with that name exists ! (epiz_32752893_db1)
if you get 1044 then the DB name is the problem
if you get 1045 then the password is a problem
6 Likes
You are right.
There is a wrong digit in the username part of the database name. Stupid me.
Thanks to you two!
4 Likes
system
Closed
May 8, 2023, 6:55am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.