# COM\_CHANGE\_USER

`COM_CHANGE_USER` resets the connection and re-authenticates with the given credentials. The packet is identical to the authentication packet in the connection handshake.

## Fields

* [int<1>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#fixed-length-integers) `0x11` : `COM_CHANGE_USER` header.
* [string\<NUL>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#null-terminated-strings) username.
* If (`server_capabilities` & `CLIENT_SECURE_CONNECTION`):
  * [int<1>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#fixed-length-integers) length of authentication response.
  * string authentication response.
* Else:
  * [string\<NUL>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#null-terminated-strings) authentication response.
* [string\<NUL>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#null-terminated-strings) default schema name.
* [int<2>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#fixed-length-integers) client character collation.
* If (`server_capabilities` & `CLIENT_PLUGIN_AUTH`):
  * [string\<NUL>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#null-terminated-strings) authentication plugin name.
* If (`server_capabilities` & `CLIENT_CONNECT_ATTRS`):
  * [int\<lenenc>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#length-encoded-integers) size of connection attributes.
  * Loop:
    * [string\<lenenc>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#length-encoded-strings) key.
    * [string\<lenenc>](/docs/server/reference/clientserver-protocol/protocol-data-types.md#length-encoded-strings) value.

## Response

Server response is like [connection authentication](/docs/server/reference/clientserver-protocol/1-connecting/connection.md) :

* An `OK` packet in case of success [OK\_Packet](/docs/server/reference/clientserver-protocol/4-server-response-packets/ok_packet.md).
* An error packet in case of error [ERR\_Packet](/docs/server/reference/clientserver-protocol/4-server-response-packets/err_packet.md).
* Authentication switch:
  * If the client or server doesn't have `PLUGIN_AUTH` capability:
    * Server sends `0xFE` byte.
    * Client sends `old_password`.
  * Else:
    * Server sends [Authentication switch request](#authentication-switch-request).
    * Client may have many exchanges with the server according to the [Plugin](#plugin-list).
  * Authentication switch ends with server sending either [OK\_Packet](/docs/server/reference/clientserver-protocol/4-server-response-packets/ok_packet.md) or [ERR\_Packet](/docs/server/reference/clientserver-protocol/4-server-response-packets/err_packet.md).

If the authentication fails more than three times, all future `COM_CHANGE_USER` commands on the connection will return the `#08S01 Unknown command` error. This is an anti-brute-force mechanism designed to prevent rapid guessing of passwords.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/clientserver-protocol/2-text-protocol/com_change_user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
