You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if you couldn't benefit to put tls=true by default and have an additional explicit config field to disable TLS if desired. So that if I want to enable TLS but want to rely on defaults, I can.
Hello, when I use the very convenient FormatDSN() function to initiate my DB connections: e.g
A DSN cannot represent all the information in a Config, nor is round-trip conversion guaranteed.
Please use sql.OpenDB(mysql.NewConnector(cfg)) instead of sql.Open("mysql", cfg.FormatDSN()).
Oh okay thanks! I didn't know that option. Every doc I checked was mentioning DSN.
So it means I don't even have to do the TLS Config registration. I can simplify my code drastically
mysqlConfig:= mysql.Config{}
connector, err:=mysql.NewConnector(&mysqlConfig) // Will use SkipVerify false by default by designdb:=sql.OpenDB(connector)
Activity
methane commentedon Sep 10, 2026
A DSN cannot represent all the information in a
Config, nor is round-trip conversion guaranteed.Please use
sql.OpenDB(mysql.NewConnector(cfg))instead ofsql.Open("mysql", cfg.FormatDSN()).celian-garcia commentedon Sep 14, 2026
Oh okay thanks! I didn't know that option. Every doc I checked was mentioning DSN.
So it means I don't even have to do the TLS Config registration. I can simplify my code drastically
I will try this.