fabric-ca-server 连接到 azure mysql:不支持此身份验证插件

fabric-ca-server connect to azure mysql: this authentication plugin is not supported

我很困惑为什么我无法使用 azure 的 MySql 数据库启动 fabric-ca-server,我一直在获取 this authentication plugin is not supported

在简单的 go 脚本中使用完全相同的连接字符串有效:

    db, err := sql.Open("mysql", sqlConnString)
    if err != nil {
        return "", err
    }
    defer db.Close()
    rows, err := db.Query(sqlString)
    if err != nil {
        return "", err
    }

    columns, err := rows.Columns()
    ...

然而启动 fabric-ca-server 时:

fabric-ca-server start --db.datasource="user@server:pw@tcp(server.mysql.database.azure.com:3306)/fabricca?parseTime=true&allowNativePasswords=true" --db.type=mysql -b admin:admin

错误结果:

2019/08/07 23:39:35 [DEBUG] Initializing DB
2019/08/07 23:39:35 [DEBUG] Initializing 'mysql' database at '****:****@tcp(server.mysql.database.azure.com:3306)/fabricca?parseTime=true'
2019/08/07 23:39:35 [DEBUG] Using MySQL database, connecting to database...
2019/08/07 23:39:35 [DEBUG] Database Name: fabricca
2019/08/07 23:39:35 [DEBUG] Connecting to MySQL server, using connection string: ****:****@tcp(server.mysql.database.azure.com:3306)/?parseTime=true
2019/08/07 23:39:35 [ERROR] Error occurred initializing database: Failed to connect to MySQL database: this authentication plugin is not supported

我试过以下版本,结果相同

使用以下参数:

mysql 服务器的版本是 5.7

我试过事先创建数据库并在没有现有数据库的情况下开始

我已经尝试过使用管理员用户,一个拥有所选数据库所有授权的特定用户

我尝试使用不同的密码插件创建用户(在 azure mysql 5.7 上默认为 mysql_native_password)

但是错误不断出现。 连接字符串似乎没有任何问题,因为我可以在其他 go 脚本中毫无问题地使用它。

尝试过使用 tls 和不使用 tls。我能看到正在使用的唯一区别是:https://github.com/hyperledger/fabric-ca/blob/477f5a2e8200232a50a3751976f6fa3d3f9062c9/lib/server/db/mysql/mysql.go#L66

有没有人以前遇到过这个问题,或者知道是怎么回事?

不幸的是,我们似乎仍在使用非常旧版本的 mysql 驱动程序,它根本不支持身份验证插件。我假设您的示例代码下载了更新版本的驱动程序。