Databases: database.exe

The database.exe utility serves to manage databases and database user accounts used by Plesk domains. The utility allows the following operations:

 

Syntax

database.exe <command> [<db_name>] [

<option1><param> [<option2><param>]…[<option N><param>]

]

 

Example

The following command creates the MySQL database jdoe-gallery on domain1.com.

>database.exe --create jdoe-gallery -domain domain1.com -type mysql

 

Commands

Command

Parameter

Description

Example

--create or -c

<db_name>

Creates a database with the specified name.

To create the John_Doe_DB database on somewhere.com:

>database.exe --create John_Doe_DB -domain somewhere.com type-mysql

or

>database.exe -c John_Doe_DB -domain somewhere.com type-mysql

--update or -u

<db_name>

Updates the database: adds, edits, removes a db user.

To update the John_Doe_DB database with a new use:

>database.exe --update John_Doe_DB -add_user Jim_Doe

or

>database.exe –u John_Doe_DB -add_user Jim_Doe

--remove or -r

<db_name>

Deletes the specified database.

To remove the John_Doe_DB database from somewhere.com:

>database.exe --remove John_Doe_DB -domain somewhere.com

or

>database.exe -r John_Doe_DB -domain somewhere.com

--help or -h

 

Displays help on the use of the utility.

To see the help info on the use of this utility:

>database.exe -–help

or

>database.exe –h

Options

Option

Parameter

Description

Example

-domain

<domain_name>

Specifies the domain name.

Required when creating a database.

To create MySQL database jdoe-gallery on domain1.com.

>database.exe --create jdoe-gallery -domain domain1.com -type mysql

-type

mssql|mysql

 

Specifies the type of the database.

Either the -type of the -server option is required when creating a database.

To create MySQL database jdoe-gallery on domain1.com.

>database.exe --create jdoe-gallery -domain domain1.com -type mysql

-server

<host[:port]>

Specifies the database server on which the database resides.

Either the -type of the -server option is required when creating a database.

To create MySQL database jdoe-gallery for domain1.com on the local MySQL server.

>database.exe --create jdoe-gallery -domain domain1.com -server localhost:3306

-passwd

<passwd>

Sets the DB user password.

Required when creating a database user.

Used with either the -add_user or -update_user option.

To change password to 123456 for the DBadmin user of the jdoe-gallery database:

>database.exe --update jdoe-gallery -update_user DBadmin -passwd 123456

-add_user

<login>

Creates a database user.

Requires use of the -passwd option.

To create the Jim_Doe user of the jdoe-gallery database users:

>database.exe --update jdoe-gallery -add_user Jim_Doe -passwd ghTTfs65Rfs

-update_user

<login>

Changes the DB user credentials (password and/or login name).

To rename the DBadmin user of the jdoe-gallery database to DBA:

>database.exe --update jdoe-gallery -update_user DBadmin -user_name DBA

-remove_user

<login>

Removes the DB user with the specified name from the database.

To remove the John_Doe DB user:

>database.exe --update John_Doe_DB -remove_user John_Doe

-user_name

<login>

Sets the login name for the DB user.

Used with the -update_user option only.

To rename the DBadmin user of the jdoe-gallery database to "DBA":

>database.exe --update jdoe-gallery -update_user DBadmin -user_name DBA