title: mysql_connect(): Access denied for user 'root'@'localhost' (using password: NO)
body: <p>I am trying to connect mysql using xampp php myAdmin. </p>
  
  <p>User <code>root</code> is there in mysql db by default.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;?php
      $dbCon=@mysql_connect("localhost", "root", '');
      if (!$dbCon)
      {
          echo('&lt;p&gt; '.mysql_error().'&lt;/p&gt;');
          exit();
      }
      else
      {
          if(!@mysql_select_db("crs",$dbCon))
       {
          die( "&lt;p&gt;".mysql_error()."&lt;/p&gt;");
       }
      }
  
      $qry="Create Table Courses( cCode VarChar(5) Not NULL Primary Key, cTitle VarChar(50) Not NULL, CH INT)";
  
      if(@mysql_query($qry))
      {
          echo('&lt;p&gt;Courses Table has been created&lt;/p&gt;');
      }
      else 
      {
          echo('&lt;p&gt;Courses Table can not be created due to' .mysql_error(). '&lt;/p&gt;');
  
      }
      $qry="Insert INTO Courses Values('C001','Intro to computing',4)";
          if (@mysql_query($qry))
          {
              echo('&lt;p&gt;C001 is inserted &lt;/p&gt;');
          }
          else
          {
              echo('&lt;p&gt;Courses Table cannot be created due to'.mysql_error().'&lt;/p&gt;');
  
          }
          $qry="Insert INTO Courses Values ('C002', 'Programming Fundamentals',4), ('C003', 'Object Oriented Programming',4), ('C004', 'Operating Systems',4), ('C005', 'Data Structures and Algorithms',4)";
          if(@mysql_query($qry))
          {
          echo('&lt;p&gt;4 Rows have been inserted&lt;/p&gt;');
          }
          else
  
              echo('&lt;p&gt;Multiple Rows cant be inserted due to'.mysql_error().'&lt;/p&gt;')           
  
  
  
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>