我遇到这样的问题,我用jsp连接mysql5.0,用mysql-front连接,无论怎么建立的帐号都可以登录,即使修改密码也照样登录,在cmd下面仍然可以连接上,就是通过jsp连接就出问题,我把错误代码贴出来,   
    
  HTTP   Status   500   -     
    
  --------------------------------------------------------------------------------   
    
  type   Exception   report   
    
  message     
    
  description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.   
    
  exception     
    
  javax.servlet.ServletException:   Communication   failure   during   handshake.   Is   there   a   server   running   on   localhost:3306?   
  org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)   
  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)   
  org.apache.jsp.mysql_jsp._jspService(mysql_jsp.java:81)   
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)   
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)   
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)   
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)   
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)   
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)   
    
    
  root   cause     
    
  java.sql.SQLException:   Communication   failure   during   handshake.   Is   there   a   server   running   on   localhost:3306?   
  org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:327)   
  org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)   
  org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)   
  org.gjt.mm.mysql.Driver.connect(Driver.java:167)   
  java.sql.DriverManager.getConnection(Unknown   Source)   
  java.sql.DriverManager.getConnection(Unknown   Source)   
  org.apache.jsp.mysql_jsp._jspService(mysql_jsp.java:50)   
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)   
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)   
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)   
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)   
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)   
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)   
    
    
  note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Tomcat   logs.   
    
    
  --------------------------------------------------------------------------------   
    
  Apache   Tomcat/5.0.16   
    
  声明一下,用root登录没问题,在没有设置密码的前提下好使,给root设置密码了,怎么都连不上,同样用grant建立拥有全部权限的用户,依然不好使,但是给新建立的用户密码设置为空就都好使了,非常的不解,我在家里调试,把mysql5.0换成了4.0,基本上没有问题了,无论设置密码与否都可以连接,我感觉是mysql版本的问题,但是我还不确定,不知道有没有权威人士给解答一下,多谢了

解决方案 »

  1.   

    是你的jsp连接mysql的驱动包没有装好
    去官方网站向下个
      

  2.   

    grant all on mysql.* to root@localhost identified by “password”; 
      

  3.   

    问题不在你的数据库上面是jsp连接mysql5.0的jar包,是这个:mysql-connector-java-5.0.8-bin.jar
      

  4.   

    Communication  failure  during  handshake.  Is  there  a  server  running  on  localhost:3306? 
    Post your result of executing statement select user,host from mysql.user.