pycharm连不上数据库:报警代码Connection to api@localhost failed. [08001] Could not create connection to d
pycharm 换成2019之后连接数据库用户名密码数据库名字都没错,就是连接不上去,网上百度一下,试试将URL后面拼接
?useSSL=false&serverTimezone=UTC
发现终于可以了 也连接上去了,但是每一次都要自己设置一下???
完美解决办法,新版的8.0版的mysql连接池应该是 以前的5.7版本是com.mysql.jdbc.Driver
试试更改时区时(往往问题都是出现在这)
a. 在终端里先使用管理员登录mysql,也就是root
mysql -uroot -p123
b. 输入命令
show variables like '%time_zone%'

c. Mysql默认为美国时间,我国时区要晚8小时,因此修改时间即可
set global time_zone = '+8:00' ;

d. 设置完以后,退出mysql,重新登录,检查时间是否被修改
结束后就退出cmd,去pycharm里面重新连接看看
所以,最好还是不要升级为新版本,因为说不定哪天就会蹦出一个新的bug让你措手不及
Django 连接mysql数据库
cmd中使用python3 manage.py migrate命令,报warn
WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoprojec
t.com/en/dev/ref/databases/#mysql-sql-mode
解决办法:settings.py文件夹加入DATABASES['OPTIONS']['init_command'] = "SET sql_mode='STRICT_TRANS_TABLES'"
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django_test',
'USER':'root',
'PASSWORD':'',
'HOST':'localhost',
'PORT':'3306',
#下面是新加入的
'OPTIONS':{
'init_command':"SET sql_mode='STRICT_TRANS_TABLES'",
'charset':'utf8mb4',
},
}
pycharm连不上数据库:报警代码Connection to api@localhost failed. [08001] Could not create connection to d的更多相关文章
- 关于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数据库错误 ...
- 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.
Error:Connection to django1@localhost failed. [08001] Could not create connection to database server ...
- 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 成功后为:
- pycharm2019连接mysql错误:08801 ------Connection to django1@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
- Connection to 天mysql failed. [08001] Could not create connection to database server. Attempted ,报错处理方法
https://blog.csdn.net/myzh215219/article/details/90314345 点击图上的DRIVER,然后点击GO TO DRIVER,之后更改合适的驱动. 我的 ...
- pycharm连接mysql是出现Connection to orm02@127.0.0.1 failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.
下面这个问题反正我是遇到了,也是难为我好几天,于是我决定发一个教程出来给大家看看!希望能帮助你们 原因: 可能是数据库的版本与本机装的驱动不匹配导致的, 解决方案一: 在 url 后面街上一句 因为笔 ...
- Connection to newtaotao failed. [08001] Could not create connection to database
jdbc.url=jdbc:mysql://localhost:3306/newtaotao?serverTimezone=UTC&characterEncoding=utf-8 数据库是5. ...
- 解决Connection to Xxx@localhost failed.
解决: Connection to jianshu@localhost failed. [08001] Could not create connection to database server. ...
随机推荐
- Bash cat EOF
cat <<EOF > ciphers.txt> ECDHE-ECDSA-AES128-GCM-SHA256> ECDHE-RSA-AES128-GCM-SHA256&g ...
- 【Activiti学习之一】Activiti入门
环境 JDK1.7 MySQL5.6 Tomcat7 Eclipse-Luna activiti 6.0 一.概念1.工作流(Workflow):是一系列相互衔接.自动进行的业务活动或任务.采用工作流 ...
- SpringCloud组件学习-图
图很清晰,直接放大浏览器,或者下载下来放大看
- Shell脚本之五 基本运算符
Shell 和其他编程语言一样,支持多种运算符,包括: 算数运算符 关系运算符 布尔运算符 字符串运算符 文件测试运算符 原生bash不支持简单的数学运算,但是可以通过其他命令来实现,例如 awk 和 ...
- 蚂蚁金服2019实习生面经总结(已拿口头offer)
一面 (37 分钟左右) 一面是上海的小哥打来的,3.12 号中午确认的内推,下午就打来约时间了,也是唯一一个约时间的面试官.约的晚上八点.紧张的一比,人生第一次面试就献给了阿里. 幸运的是一面的小哥 ...
- intellij JUnit mockito
在intellij越来越普及的情况下,利用JUnit在intellij中进行测试就显得很基础了,但网上的资料总有误导的地方,这里记录一下. 总体而言,要开始单元测试,可以分为三步,添加相关的插件,添加 ...
- python模块、异常
1. python 模块 模块是一个包含所有你定义的函数和变量的文件,其后缀名是.py.模块可以被别的程序引入,以使用该模块中的函数等功能.这也是使用 python 标准库的方法.(有点像java的c ...
- Android工具使用之UiAutomatorViewer
学习博客: https://blog.csdn.net/l403040463/article/details/79235670 使用, 添加web 网页的监控.
- Java的常用API之包装类简介
包装类 包装类: 基本数据类型,使用起来非常方便,但是没有对应的方法来操作这些基本类型的数据可以使用一个类,把基本类型的数据装起来,在类中定义一些方法,这个类叫做包装类,我们可以使用类中的方法来操作这 ...
- java中什么是包
一.什么是包 包允许将类组合成较小的单元(类似文件夹),使其易于找到和使用相应的类文件 包有助于避免命名冲突.在使用许多类时,类和方法的名称很难决定.有时需要使用与其他类相同的名称.包基本上隐藏了类并 ...