Communication failure during handshake. Is there a server running on localhost:3306?

来源:互联网 发布:黑马程序员深圳校区 编辑:程序博客网 时间:2024/05/28 19:25

今天重新部署我的工作环境,是一个Apache+PHP+Tomcat+Mysql的集成环境。

我有个追新的毛病,看到Mysql的新的stable版本释放出来我就下了一个,安装上了。其它的几个服务都调试通过了,但是Tomcat和 Mysql却连结不上,提示错误Communication failure during handshake. Is there a server running on localhost:3306?,当时以为是mm.mysql的驱动的问题,去网上察看了一下,这个2.0.4的驱动居然是2001年的,新的版本叫做作Connector/J 3.x了,。以为是这个驱动的问题,但询问了朋友,说他们那个工作正常。

Google一下吧。

先是国内有个地方说是因为root将默认的空密码设置了密码造成这个问题,我重新建立了一个用户,但是还是抱这个错误。

继续,结果在Mysql.com的官方网站上看到这个解释,是因为新的Mysql的认证机制发生了一些变化造成的,解决方法如下:

I'd to change the authentication method at the mysql server:
set password for <username>@<servername> = old_password('<password>');

将红色那部分敲进去就解决了,呵呵,特此记录一下。