title: Java wont connect to my MySQL database
body: <p>I've been trying to connect to my MySQL database but it wont connect to it. When running my application I am running it with mysql-java-connector.jar but it still wont work. </p>
  
  <p>Here is the connection method I am using: </p>
  
  <pre><code>public static void createConnection() {
          try {
              Class.forName("com.mysql.jdbc.Driver").newInstance();//opens class
              String IP="localhost:3306";//connection ip
              String DB="SECRET";//database name
              String User="SECRET";//username
              String Pass="SECRET"; //password
              con = DriverManager.getConnection("jdbc:mysql://"+IP +"/"+DB, User, Pass); //creates connection
              stmt = con.createStatement();
          } catch (Exception e) {//catches if connection failed
              System.out.println("Connection to SQL database failed!");//tells you it failed @ the run.bat
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p>The variables: </p>
  
  <pre><code>  public static Connection con = null;
    public static Statement stmt;
    public static boolean connectionMade;
  </code></pre>
  
  <p>Here is the error I get when trying to connect to my database: </p>
  
  <pre><code>java.sql.SQLException: Access denied for user 'daniel_voteuser'@'localhost' (using password: YES)
      at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052)
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:925)
      at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1704)
      at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1250)Connection to SQL database failed!
  
      at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2465)
      at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2498)
      at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2283)
      at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:822)
      at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:47)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
      at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:404)
      at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:317)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at java.sql.DriverManager.getConnection(Unknown Source)
      at com.rs.database.mysql.impl.Highscores.createConnection(Highscores.java:34)
      at com.rs.Launcher.main(Launcher.java:113)`
  </code></pre>
  
  <p>Could anyone please help me with this error? I've been trying to solve this for days but I havent managed :(</p>