我在IntelliJ IDEA 里边运行单个的java类,就可以连接到mysql数据库,但是我编译后放在tomcat下就会出现这个错误,
java.sql.SQLException: Communication failure during handshake. Is there a server
 running on localhost:3306?
        at org.gjt.mm.mysql.MysqlIO.init(Unknown Source)
        at org.gjt.mm.mysql.Connection.connectionInit(Unknown Source)
....
怎么会有这个错误的?
我的mysql明明运行的好好的

解决方案 »

  1.   

    谁能告诉我那里有J2EE 中文版的API 下载啊 谢谢了
      

  2.   

    Is there a server
     running on localhost:3306?
    没看到吗?端口问题!建议把端口改了@
      

  3.   

    我改变了端口还是出现这样的问题
    在IDE里并没有这样的问题
      

  4.   

    在my.ini文件里[client]port=3306 [mysqld]# The TCP/IP Port the MySQL Server will listen on
    port=3306我改的这两个地方的端口,还有程序里得连接字串里也改了,不知道对不对。