title: Access denied for user 'root'@'localhost' (using password: NO);
body: <p>I'm using PHP amd mysql(XAMPP). I'm trying to connect my php file with database with PDO. But it shows following error. (mysql_query(): Access denied for user 'root'@'localhost' (using password: NO)). What is the problem that I don't know. I'm using PDO first time. Please anyone will tell me that what is the problem and what is the solution. Here is my code.</p>
  
  <pre><code>$dsn = 'mysql:dbname=abc;host=localhost';
  $dbuser = 'user';
  $dbpass = 'pass';
  
  $params = array(PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION, 
              PDO::ATTR_DEFAULT_FETCH_MODE =&gt; PDO::FETCH_ASSOC);
  
  $pdo = new PDO($dsn, $dbuser, $dbpass, $params);
  </code></pre>