Go connection Azure Mysql error Error 9002 how to solve
This article introduces the relevant knowledge of "how to solve Go connection Azure Mysql error Error 9002". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
About Go connection Azure Mysql error Error 9002: SSL connection is required. Please specify SSL options and retry.
Go = 1.12
Orm github.com/go-xorm/xorm
Driver github.com/go-sql-driver/mysql
Solution:
Mysql connection address configuration parameter tls
Tls parameter description
Type: bool / stringValid Values: true, false, skip-verify, preferred, Default: false
Tls=true enables TLS / SSL encrypted connection to the server. Use skip-verify if you want to use a self-signed or invalid certificate (server side) or use preferred to use TLS only when advertised by the server. This is similar to skip-verify, but additionally allows a fallback to a connection which is not encrypted. Neither skip-verify nor preferred add any reliable security. You can use a custom TLS config after registering it with mysql.RegisterTLSConfig.
Configure URL
Xorm.NewEngine ("mysql", "username:password@tcp (host:port) / dbname?tls=skip-verify&charset=utf8"); "Go connection Azure Mysql error Error 9002 how to solve" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!