『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 6812|回复: 0

[技术探讨] HA升级2021.7后无法连接MySQL求教。【已解决】

[复制链接]

12

主题

169

帖子

1711

积分

论坛技术达人

积分
1711
金钱
1527
HASS币
60
发表于 2021-7-8 11:42:37 | 显示全部楼层 |阅读模式
本帖最后由 frx 于 2021-7-8 13:29 编辑

已解决,在密码中不能出现@,换掉密码就行了


HA升级2021.7后无法连接MySQL,查看RELEASE NOTES发现有个提示:
Recorder
The underlying library that is used for the database connections, has been updated. This fixes a bug, that might be a breaking change for you.
If you use an in your database username or password, you will have to adjust your database connection string to use instead.@%40
Database connection strings are considered URLs, thus special charaters need to be encoded. is the URL encoded version of .%40@

现在是这种连接方式:  db_url: mysql://home_assistant:[email protected]:3307/home_assistant?charset=utf8mb4
不知道该怎么调整了,数据库大下的传感器也不行
sensor:
  - platform: sql
    db_url: mysql://home_assistant:xxxxxxxxxx@192.168.2.10:3307/information_schema
    queries:
      - name: hass_db_size
        query: "select concat(round(sum(DATA_LENGTH/1024/1024),0)) as db_size from TABLES where table_schema='home_assistant';"
        column: "db_size"

        unit_of_measurement: MB

有没有大神能指点下。


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-27 08:22 , Processed in 0.627197 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表