我用ECLIPSE 连接 MYSQL 驱动为org.gjt.mm.mysql.Driver 驱动放在J2SDK\LIB和TOMCAT/COMMON/LIB并在环境变量中加了驱动路径 运行代码
import java.sql.*;
public class person
{
private static final String Drivermanager = null;
public static void main(String args[])
{ Connection conn= null;
String s="jdbc:mysql://localhost/person?user=root&password=12345";
try
{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
conn=DriverManager.getConnection(s);
System.out.print("连接成功");
}catch(Exception e)
{
System.out.println(e);
System.out.print("连接失败");
}
}
}
报错:java.sql.SQLException: Communication failure during handshake. Is there a server running on localhost:3306?
连接失败
在服务中已看见MYSQL启动,并且客户端也能登陆,我不知道这个错误是怎么回事,请高手门讲讲,不胜感激!!!