The set-db-user operation is used for changing credentials of a database user, specifying access control records for MySQL databases, restricting access to databases by IP addresses, and granting pre-defined roles to database users.
Request Packet Structure
A request XML packet changing database user settings includes the set-db-users operation node:
The set-db-user node is presented by type DatabaseSetDBUserInputType (
database_input.xsd), and its graphical representation is as follows:
- The id node is required. It specifies the ID of the database user whose preferences are to be changed. Data type: integer.
- The login node is optional. It specifies new login name for the database user. Data type: string.
- The password node is required. It specifies new password for the database user. Data type: string (length should be more than five digits).
- The password-type node is optional. It specifies whether it is a plain or encrypted password. Data type:string. Allowed values:
- The acl node is optional. It specifies the hosts from which a database user is allowed to connect to a database. Data type:DatabaseUserAclType, which consists of host elements of the string data type.
- The allow-access-from node is optional. It specifies the IP addresses from which access to a database is allowed. Data type:DatabaseUserRemoteAccessRulesType, which consists of ip-address elements of the string data type
- The role node is optional. It specifies the database user role. Data type:string. Allowed values:
You can change the settings of multiple database users in a single packet. Add as many set-db-user operations to the packet as the number of different users you want to update.
Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.
Response Packet Structure
The set-db-user node of the output XML packet is presented by the type DatabaseSetDBUserOutputType (
database_output.xsd) and is structured as follows:
- The result node is required. It wraps the response retrieved from the server. Data type: resultType (
- The status node is required. It specifies the execution status of the set-db-user operation. Data type: string. Allowed values: ok | error.
- The errcode node is optional. Is returns the error code if the set-db-user operation fails. Data type: integer.
- The errtext node is optional. It returns the error message if the set-db-user operation fails. Data type: string.
- The id node is optional. If the set-db-users operation succeeds, it specifies the ID of the updated database user. Data type: string.
This request packet sets a new password for the database user identified by ID 61, adds an ACL record, restricts access by IP address, and grants the user the Read Only role.