mysql user plugin_mysql user password plugin

该博客主要介绍了在遇到MySQL5.7客户端连接错误,提示'Plugin 'mysql_native_password' is not loaded'时的解决办法。错误可能由于不支持的认证插件引起。解决方案包括检查DSN配置,添加允许旧密码或明文密码的选项,或者确保使用正确的认证方式。
摘要由CSDN通过智能技术生成

caching_sha2_password

caching_sha2_password

caching_sha2_password

caching_sha2_password

caching_sha2_password

mysql_native_password

D:/webCodeOnline/src/vendor/github.com/go-sql-driver/mysql/errors.go:4

//Go MySQL Driver - A MySQL-Driver for Go's database/sql package//

//Copyright 2013 The Go-MySQL-Driver Authors. All rights reserved.//

//This Source Code Form is subject to the terms of the Mozilla Public//License, v. 2.0. If a copy of the MPL was not distributed with this file,//You can obtain one athttp://mozilla.org/MPL/2.0/.

packagemysqlimport("database/sql/driver"

"errors"

"fmt"

"io"

"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")

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")

ErrCleartextPassword= errors.New("this user requires clear text authentication. If you still want to use it, please add 'allowCleartextPasswords=1' to your DSN")

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 'max_allowed_packet' variable on the server")

ErrBusyBuffer= errors.New("busy buffer")

)

var errLog= Logger(log.New(os.Stderr, "[mysql] ", log.Ldate|log.Ltime|log.Lshortfile))//Logger is used to log critical error messages.

type Logger interface{

Print(v ...interface{})

}//SetLogger is used to set the logger for critical errors.//The initial logger is os.Stderr.

func SetLogger(logger Logger) error {if logger ==nil {return errors.New("logger is nil")

}

errLog=loggerreturnnil

}//MySQLError is an error type which represents a single MySQL error

type MySQLError struct {

Number uint16

Message string

}

func (me*MySQLError) Error() string {return fmt.Sprintf("Error %d: %s", me.Number, me.Message)

}//MySQLWarnings is an error type which represents a group of one or more MySQL//warnings

type MySQLWarnings []MySQLWarning

func (mws MySQLWarnings) Error() string {

var msg stringfor i, warning :=range mws {if i > 0{

msg+= "\r\n"}

msg+=fmt.Sprintf("%s %s: %s",

warning.Level,

warning.Code,

warning.Message,

)

}returnmsg

}//MySQLWarning is an error type which represents a single MySQL warning.//Warnings are returned in groups only. See MySQLWarnings

type MySQLWarning struct {

Level string

Code string

Message string

}

func (mc*mysqlConn) getWarnings() (err error) {

rows, err := mc.Query("SHOW WARNINGS", nil)if err !=nil {return}

var warnings=MySQLWarnings{}

var values= make([]driver.Value, 3)for{

err=rows.Next(values)switcherr {casenil:

warning :=MySQLWarning{}if raw, ok := values[0].([]byte); ok {

warning.Level=string(raw)

}else{

warning.Level= fmt.Sprintf("%s", values[0])

}if raw, ok := values[1].([]byte); ok {

warning.Code=string(raw)

}else{

warning.Code= fmt.Sprintf("%s", values[1])

}if raw, ok := values[2].([]byte); ok {

warning.Message=string(raw)

}else{

warning.Message= fmt.Sprintf("%s", values[0])

}

warnings=append(warnings, warning)caseio.EOF:returnwarningsdefault:

rows.Close()return}

}

}

[webdev@iZwz91pyml1gysa2ko137xZ studygolang]$ cat log/error.log-180805

16:36:16.827360 LoadAuthorities authority read fail: this authentication plugin is not supported

16:36:16.848967 LoadRoles role read fail: this authentication plugin is not supported

16:36:16.870337 LoadRoleAuthorities role_authority read fail: this authentication plugin is not supported

16:36:16.892869 loadRecommendNodes node read fail: this authentication plugin is not supported

16:36:16.910600 LoadNodes node read fail: this authentication plugin is not supported

解决 客户端连接 mysql5.7 Plugin 'mysql_native_plugin' is not loaded错误 - 吖水的程序路 - 博客园 https://www.cnblogs.com/aashui/p/8995089.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值