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. libevent笔记2:Hello_World

    本篇通过libevent提供的Hello_World demo简单介绍基于libevent的TCP服务器的实现 listener listener是libevent提供的一种监听本地端口的数据结构,在 ...

  2. 第4课 decltype类型推导

    第4课 decltype类型推导 一.decltype类型推导 (一)语法: 1.语法:decltype(expr),其中的expr为变量(实体)或表达式 2.说明: ①decltype用于获取变量的 ...

  3. history 用法大全

     history 命令用于显示指定数目的指令命令,读取历史命令文件中的目录到历史命令缓冲区和将历史命令缓冲区中的目录写入命令文件.   语法 history  [options]  [file]   ...

  4. SQLServer ---------- 附加数据库,以及解决附加时出现错误

    附加数据库的目的,进行数据库的转移,将需要的数据库,进行转移,软件在部署的时候,会经常使用 附加识别的数据库文件后缀是:  .mdf 方法: 1.首先把准备好的数据库文件,放到需要还原数据库的的电脑上 ...

  5. 国产服务器创建GSCloud实例统计

    1. GSCloud 201909 版本 完整的数据库实例 龙芯上面的瀚高4.3.4.3 数据库实例 安装耗时: 服务器配置: 龙芯3A 四核 .45G 内存8G HDD硬盘 安装耗时: 52min ...

  6. [SOJ #687]双生串(2019-11-6考试)/[hdu5431]AB String

    题目大意 把所有仅包含\(AB\)的字符串按字典序排列,给你一个仅包含\(AB\)的字符串\(S\),然后有\(Q\)个问题,第\(i\)个问题给你\(k_i\),求不是\(S\)的子串中,第\(k_ ...

  7. AGC035

    Contest Page A 唯一会做的题/kk 题目相当于要求相邻三个的异或和为\(0\). 当我们放入了三个数\(a,b,c\)时,接下来的放入顺序显然一定是\(a,b,c,a,b,c,...\) ...

  8. Go语言入门——hello world

    Go 语言源代码文件扩展名是.go. 知识点:1. go语言代码的第1行必须声明包2. 入口的go语言代码(包含main函数的代码文件)的包必须是main,否则运行go程序会显示go run: can ...

  9. MOOC Web前端笔记(三):CSS样式

    CSS样式 CSS概述 CSS--Cascading Style Shees层叠样式表 HTML定义网页的内容,CSS定义内容的样式. 内容和样式相互分离,便于修改样式. CSS语法 p{ font- ...

  10. Introducing KSQL: Streaming SQL for Apache Kafka

    Update: KSQL is now available as a component of the Confluent Platform. I’m really excited to announ ...