|
@ -81,7 +81,7 @@ func InitDB(conf request.InitDB) error { |
|
|
conf.Port = "3306" |
|
|
conf.Port = "3306" |
|
|
} |
|
|
} |
|
|
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/", conf.UserName, conf.Password, conf.Host, conf.Port) |
|
|
dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/", conf.UserName, conf.Password, conf.Host, conf.Port) |
|
|
createSql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS %s DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;", conf.DBName) |
|
|
|
|
|
|
|
|
createSql := fmt.Sprintf("CREATE DATABASE IF NOT EXISTS `%s` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;", conf.DBName) |
|
|
if err := createTable(dsn, "mysql", createSql); err != nil { |
|
|
if err := createTable(dsn, "mysql", createSql); err != nil { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|