Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 自动创建数据库失败! {"error": "错误: 语法错误 在 \"-\" 或附近的 (SQLSTATE 42601)"} #1244

Open
ciscolive opened this issue Oct 10, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@ciscolive
Copy link

gin-vue-admin 版本

最新版

Node 版本

v14.16

Golang 版本

go 1.16

是否依旧存在

可以

bug描述

无法初始化成功

o:34    自动创建数据库失败!     {"error": "错误: 语法错误 在 \"-\" 或附近的 (SQLSTATE 42601)"}
[github.com/flipped-aurora/gin-vue-admin/server]2022/10/10 - 10:58:22.289       error   D:/golang/gin-vue-admin/server/api/v1/system/sys_initdb.go:34    自动创建数据库失败!     {"error": "错误: 语法错误 在 \"-\" 或附近的 (SQLSTATE 42601)"}
[GIN] 2022/10/10 - 10:58:22 | 200 |         6m33s |       127.0.0.1 | POST     "/init/initdb"
[GIN] 2022/10/10 - 10:58:22 | 200 |     8.733174s |       127.0.0.1 | POST     "/init/initdb"

修改建议

无法初始化成功

o:34    自动创建数据库失败!     {"error": "错误: 语法错误 在 \"-\" 或附近的 (SQLSTATE 42601)"}
[github.com/flipped-aurora/gin-vue-admin/server]2022/10/10 - 10:58:22.289       error   D:/golang/gin-vue-admin/server/api/v1/system/sys_initdb.go:34    自动创建数据库失败!     {"error": "错误: 语法错误 在 \"-\" 或附近的 (SQLSTATE 42601)"}
[GIN] 2022/10/10 - 10:58:22 | 200 |         6m33s |       127.0.0.1 | POST     "/init/initdb"
[GIN] 2022/10/10 - 10:58:22 | 200 |     8.733174s |       127.0.0.1 | POST     "/init/initdb"
@ciscolive ciscolive added the bug Something isn't working label Oct 10, 2022
@SliverHorn
Copy link
Member

什么数据库,什么版本?

@mngogo
Copy link

mngogo commented Oct 16, 2022

我也卡在初始化數據報錯。 數據庫裏只生成兩個表,報錯信息說不認 nick_name. 刪除表再操作。就沒用。手動填寫config后, server端。報錯 只允許配置 一個端口 socket, 而實際檢查出 8888 .
數據庫版本都正常。目測是你的初始化裏bug。 和配置服務端口有點邏輯鎖死了

@YunxiGuo
Copy link

我这边也碰到该问题了,
数据库:postgres14
服务器操作系统:linux
CPU架构:arm64
部署方式:docker
操作:调用初始化数据库,提示"自动创建数据库失败",输入信息如下
{
"dbName": "gva",
"dbType": "pgsql",
"host": "192.168.53.207",
"password": "xxx",
"port": "5432",
"userName": "xxx"
}
错误信息如下:
/server/api/v1/system/sys_initdb.go:34 自动创建数据库失败! {"error": "ERROR: syntax error at or near "-" (SQLSTATE 42601)"}

注:在本地调试运行时,能成功创建数据库

@ccxdd
Copy link

ccxdd commented Apr 7, 2024

数据库:postgres14
操作系统:macOS
GO:1.22.1

也是遇到这个问题了,还没解决吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants
@ccxdd @mngogo @ciscolive @YunxiGuo @SliverHorn @songzhibin97 @bypanghu and others