I define:
$hostname= "localhost";
$database = "company";
$username = "dxy";
$password= "abc";
$c = mysqli_connect($hostname, $username, $password);
I get below error:
Error 2: Access denied for user 'root'@'localhost' (using password: NO)
Why it tries to connect via root@localhost
rather than dxy@localhost
?
I have another application on this dedicated server. But it connects via username@localhost
not root
....what is the wrong with this?
When I change mysqli
to mysql
, it connects perfectly.
I appreciate your help.