博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
阿里云通过镜像迁移系统后,项目报异常Unable to set localhost. This prevents creation of a GUID...
阅读量:7081 次
发布时间:2019-06-28

本文共 992 字,大约阅读时间需要 3 分钟。

hot3.png

 如题,项目通过镜像迁移到另一个服务器后,开启项目,无法链接本机Mysql,但是用开发电脑通过外网IP链接是可以的

查看日志 抛出下面两个异常

Unable to set localhost. This prevents creation of a GUID. Cause was iZj6cemhzvwh37aspfpazgZ

2017-12-08 11:41:15 [ERROR] - com.alibaba.druid.pool.DruidDataSource -Log4j2Impl.java(53) -create connection error, url: jdbc:mysql://127.0.0.1:3306/xytour?useUnicode=true&characterEncoding=utf-8, errorCode 0, state 08S01com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failureThe last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

 

意思就是系统不知道"iZj6cemhzvwh37aspfpazgZ" 是什么东西、 无法链接mysql

想了一下这"iZj6cemhzvwh37aspfpazgZ" 很像阿里云的主机命名格式,看了一下果然是旧服务器的名字,然后想到外网能连mysql,本机不能连?肯定是host的问题。。

 

编辑 /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 {你的主机名}::1         localhost localhost.localdomain localhost6 localhost6.localdomain6{主机的内网IP}  {你的主机名}

 

重启项目,搞定

转载于:https://my.oschina.net/yejunxi/blog/1586796

你可能感兴趣的文章
Web开发(初级)- DOM
查看>>
Java位移运算
查看>>
20个Docker Command
查看>>
Hadoop单节点环境配置
查看>>
在Xcode中使用Git进行源码版本控制
查看>>
在Ubuntu上安装与配置ejabberd
查看>>
我的友情链接
查看>>
我的友情链接
查看>>
编写猜数字游戏
查看>>
元素只读,disable 和readonly 区别
查看>>
python学习5-python模块
查看>>
我的友情链接
查看>>
【ROM分享】ZTE S2014 移动4G
查看>>
golang学习笔记——变量
查看>>
tomcat启动报错Invalid character found in method name. HTTP method names must be tokens
查看>>
appium+python3.6
查看>>
RAID cache的作用及更换RAID 电池注意事项
查看>>
如何挖掘和优化长尾关键词?
查看>>
windows下安装解压版mysql
查看>>
Linux启用ssh服务
查看>>