Click here to Skip to main content
15,921,295 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello, I am having a problem accessing my php file. When accessing the localhost, I see my folder name but once I click onto my folder name. It automatically redirects me to the xampp front page.

If keying in the files name like localhost/project/login.php, It comes with an error of:

Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'root'@'localhost' (using password: NO) in C:\htdocs\Liya\connection.php:6 Stack trace: #0 C:\htdocs\Liya\connection.php(6): mysqli->__construct('localhost', 'root', '', 'e-counseling') #1 C:\htdocs\Liya\login.php(3): include('C:\\htdocs\\Liya\\...') #2 {main} thrown in C:\htdocs\Liya\connection.php on line 6

What I have tried:

At first I thought it was related to my connection, So I tried to check whether my username or password or host was wrong but everything was fine. When trying to open it on my friend's laptop, it worked just fine so I am quite stumpt
Updated 22-May-23 1:22am
Richard MacCutchan 21-May-23 7:49am    
You are trying to access your database through MySQL, but the user name or ppassword are not correct. Login to MySQL manually to see why.

1 solution

It seems that your Mysql and Apache were not running when running the code, might have been the case with your friends pc where they were running -

Open the xampp-control panel(insdie the root folder xampp, select "start" on your Apache and Mysql apps. Once running successful, your localhost will operate as expected.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900