📅  最后修改于: 2022-03-11 15:05:22.399000             🧑  作者: Mango
var csb = new MySqlConnectionStringBuilder
{
Server = "Google Cloud SQL IP address",
UserID = "Your UserName",
Password = "Your Password",
Database = "Your Database/Schema Name",
SslCert = @"C:\Path\To\client-cert.pem",
SslKey = @"C:\Path\To\client-key.pem",
SslCa = @"C:\Path\To\server-ca.pem",
SslMode = MySqlSslMode.VerifyCA,
};
using var connection = new MySqlConnection(csb.ConnectionString);
connection.Open();