Database Servers: database-server Utility

The database-server utility is used to manage database server entries in Plesk through CLI. By using this utility, you can perform the following tasks:

Syntax

database-server <command> [

<option_1> [<param>]

[<option_2> [<param>]]

…[<option_N> [<param>]]

]

Example

The following command line sets the new login name newdbadmin and the new password newdbadminpass for the database server administrator on a remote database server previously available at 192.168.67.78:3838 (as recorded in the database server entry in Plesk) and sets the IP address and port number for the entry to 192.168.78.89:3636.

# ./database-server --update-server 192.168.72.16:67.78 -set 192.168.78.89:3636 -admin newdbadmin -passwd newdbadminpass

Commands

5Command

Parameter

Description

Example

--create-server

<host name or IP address>:<port number>

Creates a database server entry in Plesk. Requires concomitant use of the -type option.

To create a database server entry in Plesk for a MySQL server available at IP address and port number 192.168.67.78:3838 and set the server administrator's login name dbadmin and password dbadminpass:

# ./database-server --create-server 192.168.67.78:3838 -type mysql -admin dbadmin -passwd dbadminpass

--update-server

<host name or IP address>:<port number>

Updates database server connection settings - type, host address, port number - in the database server entry in Plesk.

The database server entry must exist in Plesk before executing this command.

The changes made by this command may adversely affect performance of site applications and user scripts.

Cannot be used to change the local MySQL database server entry settings.

To change the database server administrator's login name to newdbadmin and password to newdbadminpass on the remote MySQL server available at IP address and port number 192.168.67.78:3838:

# ./database-server --update-server 192.168.67.78:3838 -admin newdbadmin -passwd newdbadminpass

--remove-server

<host name or IP address>:<port number>

Deletes a database server entry from Plesk. Only remote database servers that has no hosted databases on it can be deleted from Plesk. A default database server cannot be deleted.

To remove the database server entry from Plesk for the database server available at IP address and port number 192.168.67.78:3838:

# ./database-server --remove-server 192.168.67.78:3838

--set-default-server

<host name or IP address>:<port number>

Assigns a remote database server entry as the default server for the database type. Only remote database servers can be set as default servers by using this command.

To set the database server server available at IP address and port number 192.168.67.78:3838 for databases of its type:

# ./database-server --set-default-server 192.168.67.78:3838

 

--set-default-server-local

 

Assigns a local database server as the default server for the database type.

Requires concomitant use of the -type option.

To set the local MySQL server as the default server for MySQL databases:

# ./database-server --set-default-server-local -type mysql

--help or -h

 

Displays help on the use of the utility.

To view help on the use of the utility:

# ./database-server --help

or

# ./database-server -h

Options

Option

Parameter

Description

Example

-set

<host name or IP address>:<port number>

Specifies the database server host and port number.

Used only with the --update-server command.

To change the IP address and port number to 192.168.78.89:3636 for the remote database server previously available at 192.168.72.16:3838 as recorded in the database server entry in Plesk:

# ./database-server --update-server 192.168.72.16:3838 -type mysql -set 192.168.78.89:3636

 

-type

mysql|postgresql

Specifies the type of a database server.

Used with --create-server, --update-server and --set-default-server-local commands.

To create a database server entry in Plesk for a MySQL server available at 192.168.67.78:3838 and set the server administrator's login name dbadmin and password dbadminpass:

# ./database-server --create-server 192.168.67.78:3838 -type mysql -admin dbadmin -passwd dbadminpass

-admin

<login name>

Specifies database server administrator's login name.

Used with the --create-server and --update-server commands.

-passwd

<password>

Specifies database server administrator's password.

Used with the --create-server and --update-server commands.

For additional comments, see the Note below the table.

Note: Use of this option is not recommended. Passing passwords through CLI as parameters of the -passwd option may potentially compromise the system's security as command line can be observed by other users of the system. It is more secure to pass passwords through the environment variables. You can transfer non-encrypted passwords by using environment variable PSA_PASSWORD while using single quotes to specify the empty values in the command line for the argument of the -passwd - -passwd_type options.