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

Options: ReplyQuote
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?

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.2 32 bit - Apache 2.4.43 - PHP 7.4.7/7.3.19/..../5.6.40 - MySQL 5.7.30 - MariaDB 10.4.12
Wampserver 3.2.2 64 bit - Apache 2.4.43 - PHP 7.4.7/7.3.19/..../5.6.40 - MySQL 5.7.30/8.0.20 - MariaDB 10.4.12
PhPMyadmin 5.0.2 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Options: ReplyQuote


Sorry, only registered users may post in this forum.