A shortcut exists for some of the command keywords. For example, you may replace
the <code>DATABASE</code> keyword with <code>DB</code>.
=Glob Syntax=
For some commands, the glob syntax can be used to address more than one database or user. Question marks and asterisks can be used to match one or more characters, and commas can be used to separate multiple patterns. Some examples:
* <code>AB?</code> addresses all names with the characters <code>AB</code> and one more character.
* <code>*AB</code> addresses all names ending with the characters <code>AB</code>.
* <code>X*,Y*,Z*</code> addresses all names starting with the characters <code>X</code>, <code>Y</code>, or <code>Z</code>.
=Valid Names=
Both database and user names must follow the same naming constraints. Valid names may contain letters, numbers, underscores and dashes. Names must have at least one character; they also should not be longer than 128 characters, although this is not enforced. A regular expression matching valid names is <code>[-_a-zA-Z0-9]{1,128}</code>.
=Database Operations=
|-
| valign='top' | '''Summary'''
|Creates the database <code>[name]</code> with an optional <code>[input]</code>.<br />The input may either be a single XML document, a directory, a remote URL or a plain XML string. <code>[name]</code> must be a [[#Valid Names|valid database name]].
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Summary'''
|Renames the database specified by <code>[name]</code> to <code>[newname]</code>. <code>[newname]</code> must be a [[#Valid Names|valid database name]].
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Summary'''
|Drops the database with the specified <code>[name]</code>. The [[#Glob syntax Syntax|Glob Syntax]] can be used to address more than one database.
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Summary'''
|Creates a zipped backup of the database specified by {{Mono|[name]}}. The backup file will be suffixed with the current timestamp and stored in the database directory. The [[#Glob syntax Syntax|Glob Syntax]] can be used to address more than one database.
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Summary'''
|Drops all backups of the database with the specified <code>[name]</code>. The [[#Glob syntax Syntax|Glob Syntax]] can be used to address more than one database.
|-
| valign='top' | '''Examples'''
|-
| valign='top' | '''Summary'''
|Creates a copy of the database specified by <code>[name]</code>. <code>[newname]</code> must be a [[#Valid Names|valid database name]].
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Summary'''
|Kills sessions of a user or an IP:port combination, specified by <code>[target]</code>. The [[#Glob syntax Syntax|Glob Syntax]] can be used to address more than one user.
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Summary'''
|Creates a user with the specified <code>[name]</code> and <code>[password]</code>. <code>[name]</code> must be a [[#Valid Names|valid user name]]. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input.
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Summary'''
|Drops the user with the specified <code>[name]</code>. If a <code>[database]</code> is specified, the user is only dropped locally. The [[#Glob syntax Syntax|Glob Syntax]] can be used to address more than one database or user.
|-
| valign='top' | '''Errors'''
|-
| valign='top' | '''Summary'''
|Grants the specified [[User_Management|permission]] to the specified <code>[user]</code>. If a <code>[database]</code> is specified, the permissions are only granted locally. The [[#Glob syntax Syntax|Glob Syntax]] can be used to address more than one database or user.
|-
| valign='top' | '''Errors'''
|Exits the console mode.
|}
=Conventions=
==Glob Syntax==
For some commands, the glob syntax can be used to address more than one database or user. Question marks and asterisks can be used to match one or more characters, and commas can be used to separate multiple patterns. Some examples:
* <code>AB?</code> addresses all names with the characters <code>AB</code> and one more character.
* <code>*AB</code> addresses all names ending with the characters <code>AB</code>.
* <code>X*,Y*,Z*</code> addresses all names starting with the characters <code>X</code>, <code>Y</code>, or <code>Z</code>.
==Valid Names==
Both database and user names must follow the same naming constraints. Valid names may contain letters, numbers, underscores and dashes. Names must have at least one character; they also should not be longer than 128 characters, although this is not enforced. A regular expression matching valid names is <code>[-_a-zA-Z0-9]{1,128}</code>.
=Changelog=