File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ type DBConfig struct {
3838 Password string `yaml:"password"` // 密码
3939 Driver string `yaml:"driver"` // 驱动
4040 Host string `yaml:"host"` // 数据库地址
41+ AllowNativePasswords bool `yaml:"allow_native_passwords"` // 是否允许nativePassword
4142
4243 // 以下配置关于连接池
4344 ConnMaxIdle int `yaml:"conn_max_idle"` // 最大空闲连接数
@@ -68,6 +69,7 @@ func (conf *DBConfig) FormatDsn() (string, error) {
6869 if err != nil {
6970 return "" , err
7071 }
72+
7173 driverConf := & mysql.Config {
7274 User : conf .Username ,
7375 Passwd : conf .Password ,
@@ -80,6 +82,7 @@ func (conf *DBConfig) FormatDsn() (string, error) {
8082 ReadTimeout : readTimeout ,
8183 WriteTimeout : writeTimeout ,
8284 ParseTime : conf .ParseTime ,
85+ AllowNativePasswords : conf .AllowNativePasswords ,
8386 }
8487 return driverConf .FormatDSN (), nil
8588}
You can’t perform that action at this time.
0 commit comments