mysql [1045] Access denied for user 'root'@'localhost' (using password: YES)
Posted by: eldonfsr (---.sd.sd.cox.net)
Date: May 25, 2020 09:03PM

I can access phpadmin to databases but don't can get access from website witch i building send me this message error.

Connection failed: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

i tried different ways to get over but don't get that

how i can solve this problem.

here is my login script.

<?php
define('servername', 'localhost');
define('username' , 'root');
define('password', 'sarf1965');
define('dbname' , 'sandoval_store');

try {
$conn = new PDO("mysql:host=". servername .";dbname=".dbname , username, password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
?>

thanks i appreciate any help.

Fernando Sandoval

Re: mysql [1045] Access denied for user 'root'@'localhost' (using password: YES)
Posted by: Otomatic (Moderator)
Date: May 26, 2020 08:31AM

Hi,

Please READ (and answer) BEFORE YOU ASK A QUESTION

Have you read: Right-click -> Help -> MySQL - MariaDB?

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Sorry, only registered users may post in this forum.