Skip to content

Unable to connect to MySQL 8 #785

Closed
Closed
@danmrichards

Description

@danmrichards

Issue description

MySQL 8 has now gone into general availability and I am seemingly unable to connect to a MySQL 8 instance as I have previously done with 5.x.

Lets say for example I have a MySQL instance running locally via Docker like so:

docker run --name some-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw -e MYSQL_DATABASE=dbname -d mysql:8

Then I can try to connect to this instance:

Example code

package main

import (
  "fmt"
  "database/sql"
  "os"
  _ "github.com/go-sql-driver/mysql"
)

func main() {
  db, err := sql.Open("mysql", "root:my-secret-pw@tcp(localhost:3306)/dbname")
  if err != nil {
    fmt.Printf("conn fail: %s\n", err)
    os.Exit(1)
  }

  if err = db.Ping(); err != nil {
    fmt.Printf("ping fail: %s\n", err)
    os.Exit(1)
  }

  fmt.Println("all good")
}

Of course I would expect this to work and I'd see the all good message (which is the case with a 5.7 instance for example). However I see the following:

Error log

ping fail: this authentication plugin is not supported
exit status 1

Configuration

Driver version (or git SHA):
3287d94

Go version: run go version in your console
go version go1.10 darwin/amd64

Server version: E.g. MySQL 5.6, MariaDB 10.0.20
8.0.11

Server OS: E.g. Debian 8.1 (Jessie), Windows 10
Mac OS 10.12.6

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions