go-sql-driver/mysql · error

this authentication plugin is not supported

Error message

this authentication plugin is not supported

What it means

ErrUnknownPlugin is returned at auth.go:342 (the default case of the auth plugin switch) when the server requests an authentication plugin that the driver does not implement. The driver logs `"unknown auth plugin: <name>"` and returns this sentinel. Known plugins are caching_sha2_password, mysql_old_password, mysql_clear_password, mysql_native_password, sha256_password, and client_ed25519.

Source

Thrown at errors.go:26

package mysql

import (
	"errors"
	"fmt"
	"log"
	"os"
)

// Various errors the driver might return. Can change between driver versions.
var (
	ErrInvalidConn       = errors.New("invalid connection")
	ErrMalformPkt        = errors.New("malformed packet")
	ErrNoTLS             = errors.New("TLS requested but server does not support TLS")
	ErrCleartextPassword = errors.New("this user requires clear text authentication. If you still want to use it, please add 'allowCleartextPasswords=1' to your DSN")
	ErrNativePassword    = errors.New("this user requires mysql native password authentication")
	ErrOldPassword       = errors.New("this user requires old password authentication. If you still want to use it, please add 'allowOldPasswords=1' to your DSN. See also https://github.com/go-sql-driver/mysql/wiki/old_passwords")
	ErrUnknownPlugin     = errors.New("this authentication plugin is not supported")
	ErrOldProtocol       = errors.New("MySQL server does not support required protocol 41+")
	ErrPktSync           = errors.New("commands out of sync. You can't run this command now")
	ErrPktSyncMul        = errors.New("commands out of sync. Did you run multiple statements at once?")
	ErrPktTooLarge       = errors.New("packet for query is too large. Try adjusting the `Config.MaxAllowedPacket`")
	ErrBusyBuffer        = errors.New("busy buffer")

	// errBadConnNoWrite is used for connection errors where nothing was sent to the database yet.
	// If this happens first in a function starting a database interaction, it should be replaced by driver.ErrBadConn
	// to trigger a resend. Use mc.markBadConn(err) to do this.
	// See https://github.com/go-sql-driver/mysql/pull/302
	errBadConnNoWrite = errors.New("bad connection")
)

var defaultLogger = Logger(log.New(os.Stderr, "[mysql] ", log.Ldate|log.Ltime))

// Logger is used to log critical error messages.
type Logger interface {
	Print(v ...any)

View on GitHub (pinned to c426bd9379)

Solutions

  1. Upgrade go-sql-driver/mysql to a version that supports the plugin.
  2. Change the user account to a supported plugin: `ALTER USER ... IDENTIFIED WITH caching_sha2_password` (MySQL) or mysql_native_password.
  3. If the plugin is non-negotiable, find a fork or contribute support; check the logged plugin name via mc.log output.

Example fix

// before
$ go get github.com/go-sql-driver/mysql@v1.6.0  // older, lacks some plugins
// after
$ go get github.com/go-sql-driver/mysql@latest
Defensive patterns

Strategy: try-catch

Validate before calling

// After connecting, query the server-advertised plugin:
// SELECT plugin FROM mysql.user WHERE user=? AND host=?
// ensure it is in the supported set before relying on it.

Type guard

var supportedPlugins = map[string]bool{"caching_sha2_password":true,"mysql_native_password":true,"sha256_password":true,"mysql_clear_password":true,"mysql_old_password":true,"client_ed25519":true}

Try / catch

if errors.Is(err, mysql.ErrUnknownPlugin) {
    log.Printf("server requested an unsupported auth plugin; upgrade driver or ALTER USER")
}

Prevention

When it happens

Trigger: The MySQL/MariaDB server advertises an auth plugin outside the implemented set — e.g. a newer MariaDB plugin (gssapi, named_pipe, dialog), an enterprise plugin, or a future plugin introduced after this driver version. The default branch at auth.go:340 fires.

Common situations: Driver version is older than the server (plugin mismatch); connecting to MariaDB with a plugin the MySQL driver lacks; corporate enterprise auth setups.

Related errors


AI-assisted analysis of go-sql-driver/mysql@c426bd9379 (2026-08-04). Data as JSON: /data/errors/cc4fc9f29ad685c0.json. Report an issue: GitHub.