title: Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
body: <p>I get the following error when I try to run the app (see below). Already tried the solutions posted on similar topics.</p>
  
  <pre><code>    Exception in thread "main" org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))
      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
      at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:456)
      at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:464)
      at com.caveofprogramming.spring.test.OffersDAO.getOffers(OffersDAO.java:26)
      at com.caveofprogramming.spring.test.App.main(App.java:16)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
  Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))
      at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
      at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
      at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
      at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
      at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
      ... 10 more
  Caused by: java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
  </code></pre>
  
  <p>After reading the solution from other similar topics I've tried the below:</p>
  
  <pre><code>- GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;
  - Change jdbc:mysql://localhost:3306/mydb to jdbc:mysql://127.0.0.1:3306/mydb
  - Create a new User
  </code></pre>
  
  <p>If I go from my CMD and I try <code>C:\mysql-5.6.21-winx64\bin&gt;mysql -u root -p -h localhost</code> I can log in with no probs. </p>
  
  <p>Any other suggestions please before I will uninstall Mysql and try to reinstal. </p>