|
|
@ -22,7 +22,7 @@ func Connect(DBHOST, DBUSER, DBPWD, DBNAME, DBPORT string, conns ...int) error { |
|
|
|
if DBHOST != "" && DBUSER != "" && DBPWD != "" && DBPORT != "" { //&& DBNAME != ""
|
|
|
|
|
|
|
|
for i := 0; i < 10; i++ { |
|
|
|
DB, dbConnErr = sql.Open("mysql", DBUSER+":"+DBPWD+"@tcp("+DBHOST+":"+DBPORT+")/"+DBNAME+"?charset=utf8") |
|
|
|
DB, dbConnErr = sql.Open("mysql", DBUSER+":"+DBPWD+"@tcp("+DBHOST+":"+DBPORT+")/"+DBNAME+"?charset=utf8mb4") |
|
|
|
if dbConnErr != nil { |
|
|
|
log.Println("ERROR", "can not connect to Database, ", dbConnErr) |
|
|
|
time.Sleep(time.Second * 5) |
|
|
|