Fatal error: Uncaught PDOException: SQLSTATE[HY000] [1045] Access denied for user ‘root’@’localhost’ (using password: YES) in /opt/lampp/htdocs/nammaschoolradio.com/admin/includes/db.php:5 Stack trace: #0 /opt/lampp/htdocs/nammaschoolradio.com/admin/includes/db.php(5): PDO->__construct(‘mysql:host=loca…’, ‘root’, ‘ ‘) #1 /opt/lampp/htdocs/nammaschoolradio.com/home.php(30): include(‘/opt/lampp/htdo…’) #2 {main} thrown in /opt/lampp/htdocs/nammaschoolradio.com/admin/includes/db.php on line 5

  PHP

Email

 <?php
$servername = "localhost";
$username = "root";
$password = "";
try {
$con = newPDO("mysql:host=$servername;dbname=#", $username, $password);
 
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// echo "Connected successfully";
}
catch(PDOException $e)
{
echo"Connection failed: ".$e->getMessage();
}
 
?>
Spread the Code

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of