I am running a PHP application that uses a few MySQL databases on Windows 10 (I used IIS to set up PHP). So far, I am getting this error:
mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES)
whenever my PHP application tries to automatically connect to PHP. However, this error goes away whenever I log in using the Command Prompt.
Can anyone shed some light on why this happens?
I am using this code to connect:
<?php
// Define database connection constants
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASSWORD', '');
define('DB_NAME', 'tutorial');
define('MAIN_TABLE_NAME', 'users');
define('THREAD', 'threads');
define('POST', 'posts');
?>
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die('Could not connect');