Skip to content

Is it possible to set the default value of "allowNativePasswords" to "true"? #642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
bingosummer opened this issue Aug 1, 2017 · 4 comments

Comments

@bingosummer
Copy link

Issue description

The default value of allowNativePasswords should be true. But it's false by default. Using other language's mysql driver, the connection is established without the option allowNativePasswords, when the mysql server requires native password authentication.
So is it possible to set the default value to true?

Example code

package main

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

func main() {
        db, err := sql.Open("mysql", "<username>:<password>@tcp(host:port)/database_name")
        if err != nil {
                log.Fatal(err)
        }
        defer db.Close()

        err = db.Ping()
        if err != nil {
                log.Fatal(err)
        }
}

Error log

2017/08/01 08:32:44 this user requires mysql native password authentication.

Configuration

Driver version (or git SHA): 1.3

Go version: go version go1.8 linux/amd64

Server version: MySQL 5.7

Server OS: N/A

@elemount
Copy link
Contributor

elemount commented Aug 2, 2017

I see allowOldPasswords and allowClearPasswords, that is needed because those password method is not secure and need to set false. But native password is the default options. Why the native password should be set false by this options?

@elemount
Copy link
Contributor

@bingosummer , Could you help to close it? The code is merged.

@julienschmidt
Copy link
Member

I can help 😉

@bingosummer
Copy link
Author

Thank everyone for this change. @elemount @julienschmidt @twocode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants