The Driver will first connect to an SSH server acting as a bastion host and then port. Package main import ( 'database/sql' 'fmt' 'log' 'net' 'os' 'context' '/go-sql-driver/mysql' '/x/crypto/ssh' '/x/crypto/ssh/agent' ) type ViaSSHDialer struct Īs you can see, most of the work is done for us in ConnectToDB() all we have to do after is use it then close it. This provisions a new MySQL database in an existing MySQL instance.