Rumah > Artikel > pangkalan data > Looking out for max values in integer-based columns in MySQL_MySQL
db,err:=sql.Open("mysql",fmt.Sprintf("%s:%s@tcp(%s:3306)/%s",mysqlUn,mysqlPw,hostToCheck,dbToCheck))
iferr!=nil{
fmt.Printf("Error connecting to MySQL on '%s': n",hostToCheck,err)
db.Close()
os.Exit(1)
}
//Checkconnectionisalive.
err=db.Ping()
iferr!=nil{
fmt.Printf("Unable to ping mysql at '%s': %sn",hostToCheck,err)
db.Close()
os.Exit(1)
}