locked
COM_CHANGE_USER command not supported RRS feed

  • Question

  • The COM_CHANGE_USER packet can be sent to reset the connection state. (This is the only way of resetting the connection in MySQL versions prior to 5.7.3, which added the COM_RESET_CONNECTION packet.) The COM_CHANGE_USER packet (http://web.archive.org/web/20170404163330/https://dev.mysql.com/doc/internals/en/com-change-user.html) contains a user ID and an 'auth-response' field that the client fills in with a hashed password. 

    If the client populates this packet with the existing user ID and a password hashed using the challenge in the initial handshake packet, then various servers behave as follows:

    • MariaDB 10.x: sends an OK packet; the user has been changed successfully
    • MySQL 5.6/5.7: sends an Authentication Method Switch Request packet, with a new challenge; replying with the new hashed password changes the user succesfully
    • Azure Database for MySQL: sends an error packet: "28000 - Access denied for user USER@IP (using password: NO)"


    At this point, the connection is broken and there's no way for the client to recover. Azure Database for MySQL should support the COM_CHANGE_USER packet by either accepting the hashed password (with the initial challenge) or replying with an Authentication Method Switch Request packet containing a new challenge.

    You can reproduce this problem in C# (with the MySql.Data or MySqlConnector NuGet package):

    // NOTE: need to opt into resetting the connection

    using (var connection = new MySqlConnection(azureConnectionString + ";Connection Reset=True")) { connection.Open(); connection.Close(); // this throws a MySqlException: Authentication to host '(HOST)' for user '(USER)' using method 'mysql_native_password' failed with message: Access denied for user '(USER)'@'(IP)' (using password: YES) connection.Open(); }




    Thursday, May 11, 2017 4:48 AM

All replies

  • Original MySqlConnector bug report (from when Azure MySQL was just in preview in China): https://github.com/mysql-net/MySqlConnector/issues/169
    Thursday, May 11, 2017 5:57 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 10:27 AM
  • Any update on this?
    Wednesday, May 17, 2017 4:20 PM
  • Hi Bradley,

    This is a known issue for MySQL service that COM_CHANGE_USER command is not supported. The PG team have plan to fix this issue, but may take time to complete.

    If you have any other questions, please let me know.

    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.

    Tuesday, June 27, 2017 9:54 AM
  • We are now fixing this issue, and will update this post when it is done and deployed, thanks for raising this issue
    Wednesday, July 5, 2017 8:03 AM
  • Hi @bgrainger 
    I think native MySQL also has this issue

    Currently MySqlConnector does not contain the connection attributes in the login package, so sending theCOM_CHANGE_USER to MySQL5.6/5.7 works fine, But if the MySqlConnector contain connection attribute(need to set the corresponding user capability bit), and then try the COM_CHANGE_USER scenario on native MySQL5.6/5.7 again, I think the MySqlConnector  would also receive  Access denied for user USER (using password: NO)" error



    • Edited by libliang116 Wednesday, July 5, 2017 8:36 AM
    Wednesday, July 5, 2017 8:33 AM
  • Any update on this?
    Thursday, September 28, 2017 5:37 AM
  • Any update on this?

    The latest update I have seen is here: https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/390#issuecomment-333007497

    "this bug has been already fixed but not deployed in all region, I assume it will be deployed soon."

    Tuesday, October 10, 2017 4:35 PM