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. Sc config http start= disabled

    我不小心使用这个命令 Sc config http start= disabled, 现在http服务 无法启动 管理员运行 sc config http start= demand & ne ...

  2. docker-compose可持续集成之nexus

    什么是 Nexus 概述 Nexus 是一个强大的仓库管理器,极大地简化了内部仓库的维护和外部仓库的访问. 2016 年 4 月 6 日 Nexus 3.0 版本发布,相较 2.x 版本有了很大的改变 ...

  3. mknod命令的使用

    1.mknod命令 在Linux系统下,mknod命令可用于系统下字符设备文件和块设备文件的创建. (1)命令语法 mknod(选项)(参数) (2)常用选项说明 -Z:设置安全的上下文. -m:设置 ...

  4. Effective.Java第1-11条

    1. 考虑使用静态工厂方法替代构造方法 一个类可以提供一个公共静态工厂方法,它只是返回类实例的静态方法.例如JDK的Boolean的valueOf方法: public final class Bool ...

  5. 62 网络编程(三)——UDP编程

    UDP编程标准步骤 服务器端 使用DatagramSocket创建服务端:DatagramSocket server = new DatagramSocket(port);//参数为自定义端口号 准备 ...

  6. day58——模板继承、组件、自定义标签和过滤器、inclusion_tag、静态文件配置、url别名和反向解析、url命名空间

    day58 模板相关 模板继承(母版继承) 1. 创建一个xx.html页面(作为母版,其他页面来继承它使用) 2. 在母版中定义block块(可以定义多个,整个页面任意位置) {% block co ...

  7. myeclipse安装android开发环境全过程

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/liang_824/article/det ...

  8. Java学习:JDBC快速入门

    本节类容 JDBC基本概念 快速入门 JDBC基本概念 概念: Java DataBase Connectivity Java 数据库连接,Java语言操作数据库 JDBC本质: 其实是官方(sun公 ...

  9. 推送一个docker 使用阿里docker hub

    阿里docker hub 地址 打开容器镜像服务页https://cr.console.aliyun.com/cn-qingdao/namespaces 这个是我的私有库 配置加速 我这边用的也是阿里 ...

  10. FileUpload上传多张照片

    <asp:FileUpload ID="uploaderInput" runat="server" multiple="multiple&quo ...