locked
Azure Database for MySQL reports incorrect version RRS feed

  • Question

  • As per http://web.archive.org/web/20170404102640/https://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::Handshake

    > When the client connects to the server the server sends a handshake packet to the client. 

    The 'server_version' in this packet is a "human-readable server version". Although it's not required to convey any semantic information, it's very useful for client developers if the version number can be used to determine supported protocol features. For example, COM_RESET_CONNECTION was introduced in MySQL Server 5.7.3.

    An Azure Database for MySQL service that is created with version 5.7 reports its version as "5.6.26.0". Here is a sample initial handshake packet received from Azure Database for MySQL Server 5.7:

    0A 35 2E 36 2E 32 36 2E 30 00 ED FF 00 00 FE FE | .5.6.26.0.......
    FE FE FE FE FE FE 00 0F AB 21 02 00 3F 00 15 00 | .........!..?...
    00 00 00 00 00 00 00 00 00 FE FE FE FE FE FE FE | ................
    FE FE FE FE FE 00 6D 79 73 71 6C 5F 6E 61 74 69 | ......mysql_nati
    76 65 5F 70 61 73 73 77 6F 72 64 00             | ve_password.
    I suggest using a server version string that both identifies the server as being on Azure and running v5.7, e.g. "5.7.0-azure".

    Note that Azure Database for MySQL Server 5.6 also reports the same server version: "5.6.26.0". This makes it impossible for client code to know whether the COM_RESET_CONNECTION packet will be accepted by the server, or return an "08S01 - Unknown command" error packet.

    Thursday, May 11, 2017 4:23 AM

Answers

  • Hi Bradley,

    This is a known limitation in the service due to the fact that the service does not know which server you want to in the handshake request packet.  

    In order to get the accurate MySQL version, run the "status" command from the MySQL prompt.

    Jason

    Tuesday, May 23, 2017 1:53 AM

All replies

  • You can also reproduce this with the following code (using the MySql.Data or MySqlConnector NuGet package):

    using (var connection = new MySqlConnection("azure connection string"))
    {
    	connection.Open();
    	Console.WriteLine(connection.ServerVersion); // prints "5.6.26.0"
    }

    Thursday, May 11, 2017 4:29 AM
  • Here are the "server-version" strings that MariaDB sends; you can see that they clearly identify the MySQL version they were based on, as well as showing the MariaDB version:

    10.0: 5.5.5-10.0.30-MariaDB-1~jessie

    10.1: 5.5.5-10.1.22-MariaDB-1~jessie

    Thursday, May 11, 2017 4:35 AM
  • Hi Bradley, 

    I was able to reproduce this issue with either Wireshark or the code you provided. We are currently looking into this issue and will give you an update as soon as possible.

    Thank you for your understanding and support.

    Regards,
    Lin

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 11, 2017 9:00 AM
  • Interestingly, "select @@version;" will still return "5.7.17-log". However, it's very useful for the client's connector library to be able to read the version out of the initial handshake and not have to incur the overhead of executing a separate query to determine this information.
    Saturday, May 13, 2017 4:32 AM
  • Hi Bradley,

    This is a known limitation in the service due to the fact that the service does not know which server you want to in the handshake request packet.  

    In order to get the accurate MySQL version, run the "status" command from the MySQL prompt.

    Jason

    Tuesday, May 23, 2017 1:53 AM
  • Interesting. I assume this is also why "fast path authentication" isn't supported (https://social.msdn.microsoft.com/Forums/en-US/7a6eac36-3e5d-4659-b522-9d6c2f93801a/fast-authentication-path-should-be-supported?forum=AzureDatabaseforMySQL) because the proxy you're initially connecting to doesn't know which backend server the client is going to request (in its username)?
    Thursday, May 25, 2017 2:39 PM
  • There is no way to get real server version using MySqlClient? Without any runing any commands?

    by the way, status command show server version 5.6 for 5.7 server. 

    http://i.imgur.com/UlGMaED.png

    • Edited by Denis V. Zavaliy Wednesday, July 12, 2017 10:30 AM add more information.
    Wednesday, July 12, 2017 10:11 AM