Skip to main content

Connect with Go

SingleStoreDB is wire-compliant with MySQL, which means you can connect to your SingleStoreDB cluster with Go similar to a MySQL database.


  • A SingleStoreDB cluster

  • Go

  • The mysql module for Go:

    go get

Connection Details

To connect your Go application to your SingleStoreDB cluster, you'll need the following information:

  • Host: the endpoint or IP Address of your SingleStoreDB cluster.

  • Port: default is 3306

  • User: root

  • Password

  • Database

Here's an example of a Go connection for a SingleStoreDB cluster:

func main() {

	PORT := "3306"
	USERNAME := "admin"
	PASSWORD := "<your admin password>"
	DATABASE := "acme"

	connection := USERNAME + ":" + PASSWORD + "@tcp(" + HOSTNAME + ":" + PORT + ")/" + DATABASE + "?parseTime=true"
	db, err := sql.Open("mysql", connection)

More Information

For a complete example, including samples of CRUD operations, refer to this GitHub repository.

For information on using stored procedures with Go, see GitHub.