I'm trying to create a DB via PHP script, but it is returning ACCESS DENIED.
<?php
$dbhost = 'localhost';
$dbuser = 'usuario_root';
$dbpass = 'senha_root';
$conn = new mysqli($dbhost, $dbuser, $dbpass);
if($conn->connect_error )
{
die('Could not connect: %s' . $conn->connect_error);
}
echo "Connected successfully\n\n";
$sql = "CREATE DATABASE novobd";
if($conn->query($sql)===TRUE){
echo "Created the database\n";
}
else {
echo "Failed to create the database: ".$conn->error;
}
//Close the database
$conn->close();
?>
ERROR:
Connected successfully Failed to create database: Access denied for user 'user_root' @ 'localhost' to database 'novobd'
Would it be some configuration in CPanel, or in PHP.ini?