Assigning Default Database Users

The default database user is used by Plesk for accessing a database if no other user is specified. The default database user, like any other database user, can manage the database either in the database management tool (such as phpMyAdmin) or by connecting directly to the database server. You can set any database user account as default. If you create a database, the first user created in the database will be the default database user.

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet assigning a default database user includes the set-default-user operation node:

<packet>
<database>
   <set-default-user>
   ...
   </set-default-user>
</database>
</packet>

 

The set-default-user node is presented by type DatabaseSetDBInputType (database_input.xsd), and its graphical representation is as follows:

  • The db-id node is required. Specifies the database that will be accessed by the default database user. Data type: integer.
  • The default-user-id node is optional. Specifying the default database user for managing a database. Data type: integer.

 

Remarks

You can set default users for multiple databases by using a single packet. Add as many set-default-user operations as the number of database default user's accounts you want to set.

<database>
   <set-default-user>
   ...
   </set-default-user>
...
   <set-default-user>
   ...
   </set-default-user>
</database>

Important: When creating request packets, put nodes and elements in the order they follow in the packet structure.

 

Response Packet Structure

The set-default-user node of the output XML packet is presented by type DatabaseSetDBOutputType (database_output.xsd) and structured as follows:

  • The result node is required. It wraps the response retrieved from the server. Data type: resultType (common.xsd).
  • The status node is required. It specifies the execution status of the set-default-user operation. Data type: string. Allowed values: ok | error.
  • The errcode node is optional. Is returns the error code if the set-default-user operation fails. Data type: integer.
  • The errtext node is optional. It returns the error message if the set-default-user operation fails. Data type: string.

 

 

Samples

Assigning a Default Database User

This request packet sets the user with ID 35 as default for the database with ID 132.

<packet>
<database>
   <set-default-user>
      <db-id>132</db-id>
      <default-user-id>35</default-user-id>
   </set-default-user>
</database>
</packet>

Response:

<packet>
<database>
   <set-default-user>
      <result>
          <status>ok</status>
      </result>
   </set-default-user>
</database>
</packet>

The negative response from the server looks as one of the follows:

  • The database with ID=132 was not found on the server.
<packet>
<database>
   <set-default-user>

      <result>
          <status>error</status>
          <errcode>1015</errcode>
          <errtext>Database not found</errtext>
      </result>

   </set-default-user>
</database>
</packet>

 The user with ID=35 was not found in the database with ID=132.

<packet>
<database>
   <set-default-user>

      <result>
          <status>error</status>
          <errcode>1015</errcode>
          <errtext>Database not found</errtext>
      </result>

   </set-default-user>
</database>
</packet>

 

 

Leave your comments on this page

Leave your feedback or question on this documentation topic below. For technical assistance, contact your hosting service provider or submit a request to Plesk support. Suggest new features for Plesk here. Discuss general questions on the Plesk forum. All offtopic comments will be removed.