# Connect Go to SQLEye

> Connect Go to a SQLEye PostgreSQL instance with pgx or a MySQL instance with go-sql-driver/mysql using 127.0.0.1 and no password.

Source: https://sqleye.com/docs/connect/go/ · Last updated: 2026-11-29 · Publisher: CodeROG (https://coderog.com)

Use a pgx connection URL for PostgreSQL and a `tcp(127.0.0.1:port)` DSN for MySQL. Create the database first, see [CLI clients](/docs/connect/cli-clients/). Replace the ports with your instance's port.

## How do I connect with pgx?

pgx's `pgx.Connect` and `pgxpool.New` accept PostgreSQL connection URLs.

```go
import (
	"context"

	"github.com/jackc/pgx/v5"
)

conn, err := pgx.Connect(context.Background(), "postgres://postgres@127.0.0.1:5432/myapp")
```

## How do I connect to MySQL?

The go-sql-driver DSN has the form `username:password@protocol(address)/dbname`, and TCP addresses are `host[:port]`.

```go
import (
	"database/sql"

	_ "github.com/go-sql-driver/mysql"
)

db, err := sql.Open("mysql", "root@tcp(127.0.0.1:3306)/myapp")
```

Sources: [pgx](https://pkg.go.dev/github.com/jackc/pgx/v5), [go-sql-driver/mysql](https://github.com/go-sql-driver/mysql#dsn-data-source-name). To see what your Go code sends, [turn on capture](/docs/live-eye/capture/).
