From eaf9974b55b3fce00da0ff969b5b4f98b6effc51 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Mon, 25 Dec 2023 01:02:06 +0800 Subject: [PATCH] mysql ping --- app/mix/dao/mysql.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/mix/dao/mysql.go b/app/mix/dao/mysql.go index 8bff8987..3cb92443 100644 --- a/app/mix/dao/mysql.go +++ b/app/mix/dao/mysql.go @@ -95,6 +95,11 @@ func NewMysql(cfg *conf.ConfigSt) (mysql *Mysql, err error) { mysql.dbVas.SetMaxOpenConns(20) mysql.dbVas.SetMaxIdleConns(10) + err = mysql.dbVas.Ping() + if err != nil { + logger.Error("MysqlDB ping fail, cfg: %v, db: %v, err: %v", util.ToJson(cfg.MixMongo), DatabaseVas, err) + return + } return }