title: Mysql Connection with out password using corejava program (getting Access denied for user 'root'@'localhost' )
body: <p>i wanted to connect for mysql database, while installing mysql i not gave any password, so  in my program i did the same but i am getting error on connection. I am using properties file to get driver,url,username and password help me pleas.</p>
  
  <p>this is my code,</p>
  
  <pre><code>try
          {
              Class.forName("com.mysql.jdbc.Driver");
              con=DriverManager.getConnection("jdbc:mysql://localhost:3306/easylibdb1","root","");
  
          } 
          catch (Exception e) 
          {
              System.out.println("Got Error While Connecting To Database...!");
              e.printStackTrace();
          }
  </code></pre>
  
  <p>this is my properties file content,</p>
  
  <p>driver=com.mysql.jdbc.Driver</p>
  
  <p>url=jdbc:mysql://192.168.1.51:3306/easylibdb1</p>
  
  <p>user=<strong>root</strong></p>
  
  <p>password=<strong>""</strong></p>
  
  <p>and stack trace is as fallow..</p>
  
  <pre><code>java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: NO)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:910)
      at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3923)
      at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1273)
      at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2031)
      at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:718)
      at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:46)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
      at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
      at java.sql.DriverManager.getConnection(DriverManager.java:579)
      at java.sql.DriverManager.getConnection(DriverManager.java:221)
      at com.easylib.AccessionFormat.mySqlConnection(AccessionFormat.java:111)
      at com.easylib.Index.main(Index.java:12)
  </code></pre>