bug fix and shell optimization

This commit is contained in:
Gordon
2021-09-13 15:48:19 +08:00
parent c1bcadd9ed
commit 649bc5657e
14 changed files with 72 additions and 42 deletions
+4
View File
@@ -2,6 +2,7 @@ package db
import (
"Open_IM/src/common/config"
"Open_IM/src/common/log"
"fmt"
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
@@ -15,10 +16,13 @@ type mysqlDB struct {
}
func initMysqlDB() {
//When there is no open IM database, connect to the mysql built-in database to create openIM database
dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=true&loc=Local",
config.Config.Mysql.DBUserName, config.Config.Mysql.DBPassword, config.Config.Mysql.DBAddress[0], "mysql")
db, err := gorm.Open("mysql", dsn)
if err != nil {
log.Error("", "", dsn)
panic(err)
}