Skip to content

Switch authentication command fails with Azure MySQL #169

Closed
@bgrainger

Description

@bgrainger

Forked from PomeloFoundation/Pomelo.EntityFrameworkCore.MySql#181.

When connecting to MySQL on Azure, even if the selected MySQL version is 5.7, the server announces its version as 5.5.0.0. This causes the ServerVersions.SupportsResetConnection test to be false because MySQL Server 5.5 didn't support the "reset connection" command. The code then tries to reset the connection by switching users. Azure MySQL sends an authentication method switch request packet. We send a response, which is rejected by the server.

The same failure to log in can be reproduced with MySql.Data by setting the ConnectionReset=true connection string setting (it's false by default). This seems to indicate it may be a problem with Azure MySQL, and not with the client.

One workaround would be to detect server version 5.5.0.0 as >= 5.7.3. This may be safe because MySQL never uses four-part version numbers (that's a Microsoft kind of thing to do), so we should never see that number when connecting to a real MySQL Server 5.5 instance. Additionally, the first GA version of MySQL Server 5.5 was 5.5.8 according to the release notes. Where this might fail is if the user is actually running MySQL Server 5.5 on Azure; presumably it would also announce its version as 5.5.0.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions