Skip to content

Commit c9c8a4f

Browse files
author
pixel
committed
修复特殊符号下初始化数据库时报错的bug
1 parent 4b7b07c commit c9c8a4f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/service/sys_initdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func InitDB(conf request.InitDB) error {
8181
conf.Port = "3306"
8282
}
8383
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/", conf.UserName, conf.Password, conf.Host, conf.Port)
84-
createSql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;", conf.DBName)
84+
createSql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS `%s` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;", conf.DBName)
8585
if err := createTable(dsn, "mysql", createSql); err != nil {
8686
return err
8787
}

0 commit comments

Comments
 (0)