I'm having this problem where it says access denied, even though the login data is correct. I've tried multiple servers but it will keep saying access denied. The machine does have access to the server. I think it's my wamp that's not working.
Error:
Connection failed: SQLSTATE[HY000] [1045] Access denied for user 'xml'@'localhost' (using password: YES)
Class:
class db
{
private $conn;
function __construct()
{
}
public function setupConnection()
{
if (!isset($conn)) {
$mysql_host = 'localhost';
$mysql_username = 'xml';
$mysql_password = '12345';
$mysql_db = 'xml';
try {
$conn = new PDO("mysql:host=" . $mysql_host . ";dbname=" . $mysql_db . "", $mysql_username, $mysql_password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
} catch (PDOException $e) {
echo "Connectie is gefaald!: " . $e->getMessage();
}
return $conn;
}
}
}