简体   繁体   中英

why is this error been thrown "Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'Ben'@'localhost' (using password: YES)"?

xammp is throwing this error despite having all the permissions granted for the root user. I have tried creating a new user with all permissions granted too but the same error was thrown. I have also tried creating a new project as I have seen was the solution to a question posted here but it didn't work for me either.

Here are the scripts and a screenshot showing my config.

<?php

require 'constants.php';

$conn = new mysqli(DB_HOST, DB_USER, DB_NAME, DB_PASS);

if ($conn-> connect_error){
    die('Database error:' .$conn->connect_error);
}

the constants file:

<?php
define("DB_HOST", "localhost");
define("DB_USER", "root");
define("DB_PASS", "");
define("DB_NAME", "user-verification");
?>

用户概览截图

You need to set Allow No Password to be true. Then you can log in without a password. Open setup configuration by going on path-to-phpmyadmin/ setup

Add New Server

Check allow no password

Apply and download this configuration file and then copy and paste it to the root folder of PHPMyAdmin.

If you already have the config.inc.php file in the PHPMyAdmin root folder. Open that file in any text editor and below line $cfg['Servers'][$i]['AllowNoPassword'] = true;

I think that might help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM