Access Denied Error for MySQL User

Hello,

I am having a persistent “Access denied” error when my PHP script tries to connect to my MySQL database, even after trying all troubleshooting steps.

Here are my account details:

My Username: if0_40160595

My Website Domain: mylevicenima.free.nf

MySQL Hostname: sql100.infinityfree.com

Database Name: if0_40160595_cinemadb

The full error message is:

Fatal error: Uncaught mysqli_sql_exception: Access denied for user ‘if0_40160595’

I have already tried the following solutions without success:

I have double-checked that the password in my PHP configuration files is correct.

I have reset my main account password and updated the configuration files with the new password.

I have completely deleted the old database and all my website files, and then started fresh by creating a brand new database and re-uploading everything.

The “Access denied” error continues to happen. This strongly suggests there is a permission or provisioning issue on the server side with my MySQL user.

Could you please check and fix the MySQL user permissions for my account if0_40160595?

Thank you for your help.

Your SQL password is separate from your account password.

In your dashboard if you go into your domain, then SQL databases, you can find your SQL password there

4 Likes

I checked your website and I now see an error saying that the database table is missing. This is progress, because it means that you can now successfully log in to the database.

5 Likes

Hello,

Thank you for your help so far. I have done more testing, and I now have definitive proof that the problem is with the server configuration for my account.

Here are the results of my tests:

Test 1: Basic PHP Test

I created a file named test.php with only this code: <?php echo "Hello World"; ?>

I visited http://mylevicenima.free.nf/test.php.

Result: SUCCESS. The page correctly displayed “Hello World”. This proves that basic PHP is working on my account.

Test 2: Database Connection Test

I replaced the content of test.php with a very simple, manually-typed database connection script. The code was:

code

PHP

download

content_copy

expand_less

<?php

$db_host = 'sql100.infinityfree.com';

$db_user = 'if0_40160595';

$db_pass = 'XXXX';

$db_name = 'if0_40160595_cinemadb';

$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);

if ($conn->connect_error) {

    echo "Connection Failed.";

} else {

    echo "Connection Success!";

}

?>

I visited http://mylevicenima.free.nf/test.php again.

Result: FAILURE. The page crashed with an HTTP ERROR 500.

Conclusion:

These tests prove that the server crashes on the line $conn = new mysqli(…). This means the PHP MySQLi extension is not working correctly on my hosting account. It is either disabled, misconfigured, or broken.

This is a server-level issue that I cannot fix myself. Could an administrator please investigate and repair the PHP MySQLi configuration for my account?

Thank you.

First of all, note that this is a public forum, so any details you share here are visible to everyone. That means, especially, DO NOT SHARE ANY SENSITIVE DETAILS SUCH AS PASSWORD HERE!

I have hidden the password in your message and reset your hosting account password for good measure.

The 500 error means that your code is crashing. But it doesn’t give any information why the code is crashing. To figure that out, please enable display_errors on your website to get an actual error message:

Note that you’ll also need to update the database password, since I reset it.

To go from “my code is crashing” to “the PHP extension is not working correctly” is a big leap in judgement that ignores a whole host of possible issues that you’re not even checking for.

7 Likes

You’ll need to turn on full error messages in your dashboard. That’ll provide more help with the error

1 Like

The original poster has a specific authentication error.

At the time of my post the page was showing an error 500. Turning on full error messages would have helped provide more details

2 Likes

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