简体   繁体   中英

Can't solve mysqli::__construct(): (HY000/1045): Access denied for user 'root'@'localhost' PhpMyAdmin erorr

I am trying to connect to my db through phpmyadmin but I can't get connected no matter what solutions I try.

I am able to connect to the phpmyadmin screen but when I try to access my webpage I am met with the error.

Here it is expanded.

mysqli::__construct(): (HY000/1045): page error

I'm trying to access the path xampp/htdocs/pfs (my site).

I am using port 4306

xampp config panel

my username/password is root and no password

config.inc.php file

db_connection.php file

Here's my phpmyadmin root user information too

phpmyadmin

Is there another file path the phpmyadmin reads username/password information from that I'm missing? Or am I trying to access my webpage in the incorrect way? I can't figure this one out.

If anyone can help I'd appreciate it.

I've tried about 20 thread solutions from stackoverflow that were titled with the mysqli::__construct(): (HY000/1045): error

I am expecting to be able to view my webpage through htdocs and then be able to show CRUD statements.

Here's what I tested.

  • Changed port to 4306 in xampp config, config.inc.php and sql my.ini file
  • Changed password to root & " " in both db_connection.php and config.inc.php (this stopped me from accessing phpmyadmin altogether)
  • Changed hostname to localhost:4306 (this stopped me from accessing phpmyadmin altogether)

you need to add database name in mysqli function call:

$mysqli = new mysqli("localhost","root","","database_name");

https://www.php.net/manual/en/mysqli.construct.php

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