Retrieving Default Database User Info

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

 

In this chapter:

Request Packet Structure

Response Packet Structure

Samples

 

Request Packet Structure

A request XML packet retrieving the default database user information includes the get-default-user operation node:

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

 

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

 

Remarks

You can retrieve ID's of multiple default database users by using a single request packet. Add the get-default-user operation for each database to the request packet.

<database>
   <get-default-user>
   ...
   </get-default-user>
...
   <get-default-user>
   ...
   </get-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 get-default-user node of the output XML packet is presented by type DatabaseGetDefaultUserOutputType (database_output.xsd) and structured as follows:

 

 

Samples

Retrieving information on the default database user

This packet retrieves a default database user of the database with ID 35.

<packet>
<database>
   <get-default-user>
      <filter>
          <db-id>35</db-id>          
      </filter>
   </get-default-user>
</database>
</packet>

Response:

<packet>
<database>
   <get-default-user>
      <result>
          <status>ok</status>
          <filter-id>35</filter-id>
          <id>77</id>
      </result>
   </get-default-user>
</database>
</packet>

 

A negative response from the server can look as follows:

<packet>
<database>
   <get-default-user>
      <result>
          <status>error</status>
          <errcode>1013</errcode>
          <errtext>Database not found</errtext>
      </result>
   </get-default-user>
</database>
</packet> 
Retrieving information on multiple default database users

This packet retrieves default database users of all databases on all database servers available for the packet sender.

<packet>
<database>
   <get-default-user>
      <filter/>
   </get-default-user>
</database>
</packet>

Reponse:

<packet>
<database>
   <get-default-user>

      <result>
          <status>ok</status>
          <filter-id>15</filter-id>
          <id>77</id>
      </result>

      <result>
          <status>ok</status>
          <filter-id>35</filter-id>
          <id>17</id>
      </result>

      <result>
          <status>ok</status>
          <filter-id>24</filter-id>
          <id>72</id>
      </result>

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