mysql: mysql5.7 unknown auth plugin
Issue description
Tell us what should happen and what happens instead mysql5.7 unknown auth plugin
Example code
// version go1.10.2 darwin/amd64
db, err := sql.Open("mysql", "admin:admin@tcp(127.0.0.1:9696)/test")
if err != nil {
fmt.Println("failed to open database:", err.Error())
return
}
defer db.Close()
rows, err := db.Query("SELECT id,str FROM test_shard_hash")
if err != nil {
fmt.Println("fetech data failed:", err.Error())
return
}
defer rows.Close()
for rows.Next() {
var id int
var str string
rows.Scan(&id, &str)
fmt.Println("uid:", id, "name:", str)
}
Error log
[mysql] 2018/06/06 22:15:07 auth.go:293: unknown auth plugin:
[mysql] 2018/06/06 22:15:07 driver.go:120: could not use requested auth plugin '': this authentication plugin is not supported
Configuration
-
Driver version (or git SHA): origin/master
-
Go version:go1.10.2 darwin/amd64
-
Server version:MySQL 5.7
-
Server OS: macOS 10.13.4 (17E202)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 21 (12 by maintainers)
Commits related to this issue
- move database testing to top — committed to michaelskyba/gopher-tables by michaelskyba 3 years ago
I upgraded and got this error:
could not use requested auth plugin 'mysql_native_password': this user requires mysql native password authentication.I’m using the proxy dialer with DialCfg from github.com/GoogleCloudPlatform/cloudsql-proxy/proxy/dialers/mysql, and in my case the simple fix was to add AllowNativePasswords in the config struct.
&mysqldriver.Config{ AllowNativePasswords: true, ... }This error was solved in my case by specifying
AllowNativePasswords: truein the configurationAllowNativePassword is true by default. You shouldn’t use
Config{}to create config object. Use DSN orNewConfig().https://godoc.org/github.com/go-sql-driver/mysql#Config
I have the same problem.
driver.go:113: could not use requested auth plugin 'mysql_native_password': this user requires mysql native password authentication.Fails on master (go get) Fails with v1.4.0 Works with v1.3.0I could provide more info if you need it. Or do you think that is another problem and I should create a new issue?
this worked in my case
I have the same question, my question is my server send the init packet without the way of auth accroding source code: auth.go:240, in func auth(), add the code: if plugin == “” { plugin = “mysql_native_password” } my problem have been solved