Erro ao tentar conectar ao Mysql

Oi pessoal, estou tendo problemas para fazer a conexão com o mysql e não consigo identificar o erro.
o erro gerado é:

Exception in thread “main” com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.

ConnectionFactory:

package br.com.caelum.tarefas;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionFactory {
	public Connection getConnection() throws SQLException {
		System.out.println("conectando  ...");
		
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			throw new SQLException(e);
		}

		return DriverManager.getConnection("jdbc:mysql://localhost/fj21",
				"root", "senha");
		
	}
	

}

Tente essa classe:

public class ConnectionFactory {

	private static Connection con = null;
	private static final String banco = ":banco:";
	private static final String user = ":usuario:";
	private static final String password = ":senha:";

	public static Connection getConnection() {
		if (con == null) {
			try {
				Class.forName("com.mysql.jdbc.Driver");
				con = DriverManager.getConnection("jdbc:mysql://localhost/" + banco, user, password);

			} catch (SQLException | ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return con;
	}

}

registre o driver uma única vez:

static {
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(ConnectionFactory.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

public static Connection getConnection() {
		if (con == null) {
			try {
				
				con = DriverManager.getConnection("jdbc:mysql://localhost/" + banco, user, password);

			} catch (SQLException | ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return con;
	}