database-server: Database Servers

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:

  • creating database server entries in Plesk
  • setting and editing database server connection parameters in the entries

Usage
database-server <command> [
<option_1> [<param>]
[<option_2> [<param>]]
... [<option_N> [<param>]]
]

Example

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

plesk bin database-server --update-server 192.0.2.78:67.78 -set 192.0.2.89:3636 -admin dbadmin -passwd dbpass

Commands
Command Parameter Description Example

--create-server

<host>:<port>

Creates a database server entry in Plesk.

Requires -type option.

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

plesk bin database-server --create-server 192.0.2.78:3838 -type mysql -admin dbadmin -passwd dbpass

--update-server

<host>:<port>

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

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 newadmin and password to newpass on the remote MySQL server available at IP address and port number 192.0.2.78:3838:

plesk bin database-server --update-server 192.0.2.78:3838 -admin newadmin -passwd newpass

--remove-server

<host>:<port>

Deletes a database server entry from Plesk.

Only remote database servers that have 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.0.2.78:3838:

plesk bin database-server --remove-server 192.0.2.78:3838

--set-default-server

<host>:<port>

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 available at 192.0.2.78:3838 for databases of its type:

plesk bin database-server --set-default-server 192.0.2.78:3838

--set-default-server-local

 

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

Requires -type option.

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

plesk bin database-server --set-default-server-local -type mysql

--list or -l

 

Displays the list of database servers registered in Plesk.

To see the list of database servers registered in Plesk:

plesk bin database-server --list

--xml-info or -xi

 

Displays the list of database servers registered in Plesk in the XML format.

To see the list of database servers registered in Plesk in the XML format:

plesk bin database-server --xml-info

--help or -h

 

Displays help on the use of the utility.

To view help on the use of the utility:

plesk bin database-server --help

or

plesk bin database-server -h

Options
Option Parameter Description Example

-set

<host>:<port>

Specifies a database server host and port number.

Used only with the --update-server.

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

plesk bin database-server --update-server 192.0.2.16:3838 -type mysql -set 192.0.2.89:3636

-type

mysql|postgresql

Specifies the type of a database server.

Required with --create-server and --set-default-server-local.

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

plesk bin database-server --create-server 192.0.2.78:3838 -type mysql -admin dbadmin -passwd dbpass

-admin

<login_name>

Specifies database server administrator's login name.

-passwd

<password>

Specifies database server administrator's password.

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 option.

 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.