在连接mysql jdbc时候,抛出了

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communication link failure,  message from server: "Can't get hostname for your address"

的错误,无论是使用jdbc:mysql://127.0.0.1:3306还是jdbc:mysql://localhost:3306都出现了这个错误。

这个报错的意思是“您的地址无法获得主机名”,想到skip-name-resolve参数,但是加了这个参数后,由于我使用的是windows安装的服务,故还是有这个错误,终于在一篇博文中找到了解决方案。http://blog.csdn.net/zzti_erlie/article/details/53227343

对于是绿色版的mysql,需要打开my.ini,加上

[mysqld]
skip-name-resolve
#忽略主机名的方式访问
lower_case_table_names=1
#忽略数据库表名大小写

然后重启服务,该方案确实有效,但是对安装服务的mysql就没有效果了!

对于是安装到windows服务的mysql,需要在服务管理中点击选中MySQL服务,右键打开属性

mysql Communication link failure, message from server: "Can't get hostname for your address"的更多相关文章

  1. Mysql Communication link failure :1153 Got a packet bigger than 'max_allowed_packet' bytes

    出现这种情况: 临时解决方法是: 登录mysql: 执行: set global max_allowed_packet=1000000000;       set global net_buffer_ ...

  2. mysql Communications link failure Last packet sent to the server was X ms ago

    想必大家在用MySQL时都会遇到连接超时的问题,如下图所示: 就是这个异常(com.mysql.jdbc.exceptions.jdbc4.Communication***ception:Commun ...

  3. jdbc 连接mysql Communications link failure的解决办法

    使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误: Communications link failure,The last packet successfully r ...

  4. Mysql Communications link failure 问题的解决

    问题现象 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last p ...

  5. mysql Communications link failure,C3p0的参数详解

    MySQL默认一个连接空闲8小时候就会自动断开,而这时程序以为连接还能使用,然后在使用的时候就会出现Communications link failure异常. 这时需要进行两步设置,有时候只设置My ...

  6. Mysql:报错message from server: "Too many connections"(连接太多)

    报错信息 Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source re ...

  7. MySQL数据库罕见的BUG——Can't get hostname for your address

    在连接mysql jdbc时候,抛出了 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communicat ...

  8. redhat 连接mysql数据库Can't get hostname for your address

    redhat 连接mysql数据库Can't get hostname for your address Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQ ...

  9. 错误解决记录------------mysql连接本地数据库显示"can't get hostname for your address"

    mysql连接本地数据库遇到 can't get hostname for your address 不明原因的本地mysql数据库连接不上,总是显示can't get hostname for yo ...

随机推荐

  1. if __name__ == '__main__' 含义

    if __name__ == '__main__': app.run(host = '0.0.0.0',debug=app.config['DEBUG']) 1.是项目入口的含义2.如果是在生产环境下 ...

  2. 【Linux】linux下gzip的压缩/解压缩详解

    Linux压缩保留源文件的方法: gzip –c filename > filename.gz Linux解压缩保留源文件的方法: gunzip –c filename.gz > file ...

  3. maven 打包时提示 软件包 xxxxxxx 不存在

    右键项目->MAVEN->Update Project Configuration然后clean相关项目再打包如果还不行   在你关联包的路径下  把所有文件删掉  在打包的时候会重新下载 ...

  4. 基于jQuery的新浪游戏首页幻灯片

    分享一款基于jQuery的新浪游戏首页幻灯片,带左右箭头,选项卡缩略图,自动轮播切换的jQuery幻灯片代码.效果图如下: 在线预览   源码下载 实现的代码. html代码: <br>& ...

  5. Android Studio SVN使用

    昨天弄了一天的Android Studio svn,感觉没有eclipse的svn好装,中间遇到很多的麻烦问题.这里来记录下吧 上传比较简单,就直接贴我看我别的的上传教程. https://blog. ...

  6. spring @Bean注解解释

    解释:java config配置一个重要注解 @Bean明确地指示了一种方法,什么方法呢——产生一个bean的方法,并且交给Spring容器管理:从这   我们就明白了为啥@Bean是放在方法的注释上 ...

  7. web前端开发与iOS终端开发的异同[转]

    * {-webkit-tap-highlight-color: rgba(0,0,0,0);}html {-webkit-text-size-adjust: none;}body {font-fami ...

  8. fast neural style transfer图像风格迁移基于tensorflow实现

    引自:深度学习实践:使用Tensorflow实现快速风格迁移 一.风格迁移简介 风格迁移(Style Transfer)是深度学习众多应用中非常有趣的一种,如图,我们可以使用这种方法把一张图片的风格“ ...

  9. CAS (10) —— JBoss EAP 6.4下部署CAS时出现错误exception.message=Error decoding flow execution的解决办法

    CAS (10) -- JBoss EAP 6.4下部署CAS时出现错误exception.message=Error decoding flow execution的解决办法 jboss版本: jb ...

  10. 标签<view>文字自动换行

    <view style='word-break:break-all;'>{{con.blog}}</view>