My php code is below:
<?php
$host = 'localhost';
$dbname = 'db_skrining';
$user = 'root';
$pass = '';
$con = mysqli_connect($host,$user,$pass,$dbname);
if(!$con){
die("Connection Failed".mysqli_connect_error());
}
echo "Success";
?>
And what I get is the error:
Fatal error: Uncaught mysqli_sql_exception: Access denied for user 'root'@'localhost' (using password: NO) in C:xampphtdocsskriningauthkonfigurasi.php:7 Stack trace: #0 C:xampphtdocsskriningauthkonfigurasi.php(7): mysqli_connect('localhost', 'root', '', 'db_skrining') #1 {main} thrown in C:xampphtdocsskriningauthkonfigurasi.php on line 7.
Here’s what the solutions I’ve tried so far:
-
Changing the IP settings in the “phpMyAdmin/config.inc.php” into the port I’ve assigned on the Apache XAMPP MySQL main port in the “Service and Port Settings”. Not solved.
-
Recheck numerous times about the port, the dbname, the user ‘root’ and the password it’s still the same as default settings (both in the config.icg and the sql.ini [haven’t changed anything so far]. But I noticed that the password section on “sql.ini” file is “your_password” (without “…”); if that’s the case. but not solved
-
Use
try{...}
andcatch(){}
, mysqli_connect_strict alsomysqli_connect_errno
. still, not solved yet
Attachments:
conf.php file; editor used: VSCode
Thank you