解决Connection to Xxx@localhost failed.
解决:
Connection to jianshu@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
原因
2019最新版本IDEA,Pycharm连接JDBC方式为Mysql6中的com.mysql.cj.jdbc.Driver,这个方法需要指定时区【serverTimezone】
driverClassName=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/test?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&useSSL=false
username=root
password=
老版本使用为Mysql5中的com.mysql.jdbc.Driver,不需要指定时区
driverClassName=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&useSSL=false
username=root
password=
没懂??? 看图

解决方法
更新mysql,官网下载
8.0+版本解决,我本地用的MySQL5.7懒得改了就不用这个办法了设置连接Mysql方式为5.x版本

问题
1.1 问题描述
最近把IDEA升级到2019版本发现数据库一直连接不上,一直提示时区错误【mysql时区问题解决方法】,解决完后发现数据库显示已连接但是无法查看数据库内容

网上找了资料才知道IJ大哥把2019版本的IDEA Pycharm连接方式都默认改为了com.mysql.cj.jdbc.Driver
1.2 报错截图

解决
更改IDEA连接方式

搞定✔
解决Connection to Xxx@localhost failed.的更多相关文章
- 关于Django数据库mysql连接错误问题Connection to api@localhost failed. [08001] Could not create connection to d
Connection to api@localhost failed. [08001] Could not create connection to d 错误类型 django连接mysql数据库错误 ...
- pycharm2019连接mysql错误08801 ------Connection to django1@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Error:Connection to django1@localhost failed. [08001] Could not create connection to database server ...
- pycharm连不上数据库:报警代码Connection to api@localhost failed. [08001] Could not create connection to d
pycharm 换成2019之后连接数据库用户名密码数据库名字都没错,就是连接不上去,网上百度一下,试试将URL后面拼接 ?useSSL=false&serverTimezone=UTC 发现 ...
- Connection to api@localhost failed. [08001] Could not create connection to d
pycharm 换成2019之后连接数据库用户名密码数据库名字都没错,就是连接不上去,网上百度一下,试试将URL后面拼接 ?useSSL=false&serverTimezone=UTC 发现 ...
- pycharm2019连接mysql错误:08801 ------Connection to django1@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
- IntelliJ IDEA连接不上数据库 (Connection to testdb@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.)
问题提示为: 原因:MySQL数据库版本为8.0以上,需要在URL加上时区,即加上?serverTimezone=GMT 成功后为:
- Fiddler [Fiddler] Connection to localhost. failed.
原文地址:http://blog.chinaunix.net/uid-20675015-id-1899931.html 在用Fiddler调试本机的网站时,即访问http://localhost,返回 ...
- Server Tomcat v7.0 Server at localhost failed to start.临时解决办法
错误名:Server Tomcat v7.0 Server at localhost failed to start. 解决办法:去掉下面这句话: (通常在代码开头部分,public class前) ...
- Server Tomcat v7.0 Server at localhost failed to start解决办法
今晚搞了下tomcat,在调试的时候发现报了这样一个错误Server Tomcat v7.0 Server at localhost failed to start 首先,确认了端口号8080是不是被 ...
随机推荐
- Java对象的"后事处理"——垃圾回收(二)
1 先谈Finalize() finalize()能做的所有工作,使用try-finally或者其他方式都可以做得更好.更及时,所以笔者建议大家完全可以忘掉Java语言中有这个方法的存在. ——< ...
- UVA12433 【Rent a Car】
这题应该算是比较难的一道网络流的题,(但却在我校OJ考试上出现了),但是大家只要能理解此图的建边方式就行. 假设有5天的租车需求,虚拟出2*n+2 即 12个节点,0为源点,12为汇点. 1,源点到1 ...
- NOIP模拟13
上来看了一遍题,发现T2似乎不可做...暴力只给20分怎么玩? T1感觉是要离线处理,但是看了一会发现不会,遂决定先打暴力.然后去把T2 20分拿了,回去看T1,手摸了一下样例,成功推出式子,5分钟码 ...
- 基于Rancher搭建Kubernetes
基于Rancher搭建Kubernetes可以大大的简化安装的步骤,直接安装Kubernetes操作复杂并且容易出错. 转自 https://blog.csdn.net/u011142688/arti ...
- 同余类BFS的一些瞎吹
同余类BFS的题,是个OIer基本上都会见过一些,最好的例子就是NOIP 2018 day1 T2---货币系统 虽然这题其实是什么背包就能解决的题目,但数据一变大,出题人坏一点,就没了.... 同 ...
- zabbix 4.2 的安装和设置(mysql57----centos7)
一.安装RPM [root@localhost ~]# rpm -ivh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release ...
- 架构设计:"4+1"视图
概念 "4+1"视图,是指从5个不同视角来描述软件体系结构. "4+1"分别指: 逻辑视图 过程视图 物理视图 开发视图 场景/用例 视图 逻辑架构的描述可以围 ...
- go 学习笔记之咬文嚼字带你弄清楚 defer 延迟函数
温故知新不忘延迟基础 A "defer" statement invokes a function whose execution is deferred to the momen ...
- mysql 创建用户及授权(1)
一. 创建用户 命令: CREATE USER 'username'@'host' IDENTIFIED BY 'password'; 说明: username:你将创建的用户名 host:指定该用户 ...
- 力扣(LeetCode)反转链表 个人题解
反转一个单链表. 示例: 输入: 1->2->3->4->5->NULL 输出: 5->4->3->2->1->NULL 进阶:你可以迭代或 ...