I'm having a problem when doing a test with a PHP code on my server.
The code would be:
<?php
if(isset($_POST["id"]) && is_numeric($_POST["id"])) {
$id=$_POST["id"];
}
else {
$id=1;
}
$mysqli = new mysqli('[IP de mi servidor]', 'root', '[mi contraseña]', '[mi DB]');
if($mysqli->connect_errno) {
die("Conexión con el servidor fallida (" . $mysqli->connect_error . ").");
}
?>
There is more code later, but the error that is executed is that.
I have tried to include the IP in the user (root @ [my IP]), to restart the server, etc., and I still have the error
Access denied for user 'root' @ 'localhost' (using password: YES)
However, if I go from PuTTY to MySQL with the root user and the same password, I have full access.