ccfos / nightingale

An all-in-one observability solution which aims to combine the advantages of Prometheus and Grafana. It manages alert rules and visualizes metrics, logs, traces in a beautiful web UI.
https://flashcat.cloud/docs/
Apache License 2.0
9.55k stars 1.39k forks source link

启动报错 failed to query user root: Error 1054: Unknown column 'username' in 'where clause' #2048

Closed lyc0221 closed 1 month ago

lyc0221 commented 1 month ago

Question and Steps to reproduce

image

Relevant logs and configurations

启动报错:
n9e: failed to query user root: Error 1054: Unknown column 'username' in 'where clause'

Mysql配置项
[DB]
# postgres: host=%s port=%s user=%s dbname=%s password=%s sslmode=%s
# postgres: DSN="host=127.0.0.1 port=5432 user=root dbname=n9e_v6 password=1234 sslmode=disable"
# sqlite: DSN="/path/to/filename.db"
DSN = "n9e:xxxxxxxxxx@tcp(127.0.0.1:3306)/nightingale?charset=utf8mb4&parseTime=True&loc=Local&allowNativePasswords=true"
# enable debug mode or not
Debug = false
# mysql postgres sqlite
DBType = "mysql"
# unit: s
MaxLifetime = 7200
# max open connections
MaxOpenConns = 1500
# max idle connections
MaxIdleConns = 500
# enable auto migrate or not
# EnableAutoMigrate = false

Version

以下两个版本都试过,仍然是同一个报错

n9e-v7.0.0-beta.14.3-linux-amd64.tar.gz n9e-v7.0.0-beta.14-linux-amd64.tar.gz

UlricQin commented 1 month ago

看看你的 DB 里的表结构是否创建成功,是否默认插入了一个 root 账号在 users 表里

lyc0221 commented 1 month ago

表结构和root账号都正常,是不是数据库名不能改?只能是n9e_v6吗?

UlricQin commented 1 month ago

表结构和root账号都正常,是不是数据库名不能改?只能是n9e_v6吗?

可以改,我看你的配置DB是nightingale,只要相关的表都在 nightingale 库里就行。当然,你也可以改成 n9e_v6 来验证你的想法

lyc0221 commented 1 month ago

测试了,数据库名用nightingale不行,改成n9e_v6就正常,不知道什么原因