解决 invalid DSN: missing the slash separating the database name
完整的报错:GOROOT=C:\Go #gosetupGOPATH=D:\tools\bb #gosetupC:\Go\bin\go.exe build -o C:\Users\ccb\AppData\Local\Temp\___1go_build_go_web_study_main.exe go-web-study/main #gosetupC:\Users\ccb\AppData\Local\
·
完整的报错:
GOROOT=C:\Go #gosetup
GOPATH=D:\tools\bb #gosetup
C:\Go\bin\go.exe build -o C:\Users\ccb\AppData\Local\Temp\___1go_build_go_web_study_main.exe go-web-study/main #gosetup
C:\Users\ccb\AppData\Local\Temp\___1go_build_go_web_study_main.exe #gosetup
panic: invalid DSN: missing the slash separating the database name
问题定位: invalid DSN: missing the slash separating the database name
这句话翻译过来: 无效DSN:缺少分隔数据库名称的斜杠
原来grom这套框架在进行数据库初始化的open时,它的第二个参数与sqlx有所区别,应该是
Dbs,err = gorm.Open("mysql","用户:密码@/库名?charset=utf8&parseTime=True&loc=Local")
@ 符号后边需要一个 /
更多推荐
已为社区贡献2条内容
所有评论(0)