前言

意思是根据你的地址找不到主机名,试了在my.ini文件加各种东西还是不管用,看到能改服务就试了一下,果然就成功了,这个方法只限于本地访问MySQL数据库失败,要是你真是用网络服务,还是在my.ini文件中加各种东西吧

打开服务页面,观察MySQL的服务是否为网络服务

右键单击计算机,选择管理,最下面有服务和应用程序选项,点击服务就是如下界面

Can‘t get hostname for your address解决办法_ssl


我这里MySQL57已经改为本地系统了,原来是网络服务

如果是网络服务,点击选中MySQL服务,右键打开属性

Can‘t get hostname for your address解决办法_ide_02


设置为如下即可,一连果然成功了,结果又遇到这个警告(忽略即可,也可以通过加参数得到解决)

Sat Nov 19 08:59:14 CST 2016 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

参考这个博客得到解决:http://www.mamicode.com/info-detail-1262842.html

推荐

Can‘t get hostname for your address解决办法_ide_03