title: No suitable driver found for 'jdbc:mysql://localhost:3306/mysql
body: <p>Using Java, I get this error when attempting to connect to a mysql database:</p>
  
  <pre><code>java.sql.SQLException: No suitable driver found for 
  jdbc:mysql://localhost:3306/mysql at
  java.sql.DriverManager.getConnection(Unknown Source)
  at java.sql.DriverManager.getConnection(Unknown Source)
  at MyTest1.main(MyTest1.java:28)
  </code></pre>
  
  <p>I'm using the <code>mysql-connector-java-5.1.18-bin.jar</code> driver.  It is in my build path.  I have restarted MySQL.  I've also logged on from the command line with root and no password and it connected fine.  I'm not currently seeing a port 3306 in netstat.  Previously I was getting a different error (I didn't change the code).  The error was "jdbc mysql Access denied for user 'root'@'localhost password NO"</p>
  
  <pre><code>try {
      Class.forName("com.mysql.jdbc.Driver");
  } 
  catch (ClassNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  } 
  
  
  try {
      String url = "jdbc:mysql://localhost:3306/mysql";
      Connection con = DriverManager.getConnection(url, "root", "");
  }
  catch (Exception e){
      e.printStackTrace();
  }
  </code></pre>