From 2b805ff77078bbd690099a081eb74d388ddd7e61 Mon Sep 17 00:00:00 2001 From: TBXark Date: Mon, 22 May 2023 14:26:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20mysql=E5=AF=86=E7=A0=81=E4=B8=AD?= =?UTF-8?q?=E6=9C=89=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=8B=BC=E6=8E=A5=E7=9A=84MysqlDns=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/config.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config/config.go b/src/config/config.go index 1a98119..0708260 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -3,6 +3,7 @@ package config import ( "fmt" "github.com/spf13/viper" + "net/url" "os" "time" ) @@ -41,8 +42,8 @@ func Init() { RuntimePath, viper.GetString("log_save_path")) MysqlDns = fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", - viper.GetString("mysql_user"), - viper.GetString("mysql_passwd"), + url.QueryEscape(viper.GetString("mysql_user")), + url.QueryEscape(viper.GetString("mysql_passwd")), fmt.Sprintf( "%s:%s", viper.GetString("mysql_host"),