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的更多相关文章

  1. 关于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数据库错误 ...

  2. Connection to api@localhost failed. [08001] Could not create connection to d

    pycharm 换成2019之后连接数据库用户名密码数据库名字都没错,就是连接不上去,网上百度一下,试试将URL后面拼接 ?useSSL=false&serverTimezone=UTC 发现 ...

  3. 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 ...

  4. 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 成功后为:

  5. pycharm2019连接mysql错误:08801 ------Connection to django1@localhost failed. [08001] Could not create connection to database server. Attempted reconnect 3 times. Giving up.

  6. 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,之后更改合适的驱动. 我的 ...

  7. 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 后面街上一句 因为笔 ...

  8. Connection to newtaotao failed. [08001] Could not create connection to database

    jdbc.url=jdbc:mysql://localhost:3306/newtaotao?serverTimezone=UTC&characterEncoding=utf-8 数据库是5. ...

  9. 解决Connection to Xxx@localhost failed.

    解决: Connection to jianshu@localhost failed. [08001] Could not create connection to database server. ...

随机推荐

  1. [技术博客] JS正则活学活用

    正则基本语法 正则表达式(Regular Expression)是用单字符串来匹配一系列复合条件字符串的模式,对于乔姆斯基3型语法. 数学定义: 串行AB表示集合 {αβ | α ∈ A ,β ∈ B ...

  2. dnsperf

    github 地址:https://github.com/DNS-OARC/dnsperf mac安装:brew install dnsperf 参数详解 Dnsperf 支持下面的这些命令行参数: ...

  3. 【操作系统之七】Linux常用命令之tail

    一.概念linux tail命令用途是按照要求将指定的文件的最后部分输出到标准设备,一般是终端,就是把某个档案文件的最后几行显示到终端上,如果该档案有更新,tail会自动刷新,确保你看到最新的档案内容 ...

  4. dial tcp 10.96.0.1:443: getsockopt: no route to host --- kubernetes(k8s)DNS 服务反复重启

    kubernetes(k8s)DNS 服务反复重启解决: k8s.io/dns/pkg/dns/dns.go:150: Failed to list *v1.Service: Get https:// ...

  5. 模拟 + 打表 --- Emag eht htiw Em Pleh

    Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 2578   Accepted: ...

  6. java异常的基本概念和处理流程

    一.异常的基本概念 在java中把导致程序中断运行的情况分为两种,一种就是异常,而另外一种叫做错误.所有异常的基类是Exception,错误的基类是Error.Exception是在java程序中可以 ...

  7. linux启动tomcat很久或者很慢Tomcat启动时卡在“INFO: Deploying web application directory ......”的解决方法

    解决方案: 找到jdk1.x.x_xx/jre/lib/security/java.security文件,在文件中找到securerandom.source这个设置项,将其改为: securerand ...

  8. Implementing Azure AD Single Sign-Out in ASP.NET Core(转载)

    Let's start with a scenario. Bob the user has logged in to your ASP.NET Core application through Azu ...

  9. pickle导入变量AttributeError的解决方案

    问题描述: AttributeError: 'module' object has no attribute ‘attr1’ 解决方案: # 找到报错的文件a.py from a import att ...

  10. Ubuntu 挂载硬盘命令介绍

    版权声明:本文为博主原创文章,欢迎转载与采用. https://blog.csdn.net/HinstenyHisoka/article/details/71055656 新升级了Ubuntu 从16 ...