try { $conn = new PDO ( "mysql:host=localhost; dbname=pdo" , "root", ""); $conn -> setAttribute (PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected Successfully"; } catch (PDOException $e) { echo "Connection Failed...". $e -> getMessage(); }Connection Failed...SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)