Connect with Go

You can get started with SingleStore (formerly MemSQL) and Go quickly. SingleStore is wire-compliant with MySQL, meaning connecting to SingleStore is as easy as connecting to a MySQL database.

The sections below describe how to connect your application. For a complete example, including samples of CRUD operations, refer to this GitHub repo.


  • A SingleStore cluster

  • Go

  • The mysql module for Go: go get

Connection Details

To connect your Go application to your SingleStore cluster (SingleStore DB or SingleStore Managed Service) you'll need the following:

  • Host: the endpoint (SingleStore Managed Service) or IP Address (SingleStore DB) for your cluster. You can find the endpoint in the SingleStore Portal.

  • Port: default is 3306

  • User: admin (SingleStore Managed Service) or root (SingleStore DB).

  • Password

  • Database

Here is an example of a Go connection for a SingleStore Managed Service 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

Using Stored Procedures: GitHub