Database management command syntax

Almost all administration commands have variations. The most common variations include parts of the commands that are optional, or that can have multiple values. Some variations are indicated using special characters. See Reading the administration commands syntax for details.

This page summarizes the various command syntax options. It also includes examples for both Cypher 5 and Cypher 25 when available.

Cypher® versions

As of Neo4j 2025.06, the Cypher language is decoupled from the Neo4j server and follows its own versioning. Currently, there are two versions of Cypher available: Cypher 5 and Cypher 25. You can specify the version of Cypher by configuring a default Cypher version for the whole DBMS by explicitely setting db.query.default_language configuration in the neo4j.conf file, per database when using CREATE DATABASE or ALTER DATABASE, or by prepending the query with CYPHER 5 or CYPHER 25 on a per-query basis to override the default. For more information, see the Configure the Cypher default version and Cypher Manual → Select Cypher version.

Cypher 5

Cypher 5 is the language version with which all queries written for Neo4j 2025.05 and earlier versions are compatible. However, as of Neo4j 2025.06, it is frozen and will only receive performance enhancements and bug fixes in future server releases.
Setting the default language to CYPHER 5 ensures that all queries run on that database use the version of Cypher 5 as it existed at the time of the Neo4j 2025.06 release (unless you prepend your queries with CYPHER 25, which overrides this default). Any changes introduced after the 2025.06 release do not affect the semantics of the query.
Cypher 5 remains the default version for all newly created databases unless db.query.default_language=CYPHER_25 is explicitly set on the DBMS level or overridden using CREATE DATABASE or ALTER DATABASE, or by prepending queries with CYPHER 25.

Cypher 25

Cypher 25 builds upon Cypher 5 and includes new and improved features, as well as some removals. Any new Cypher features introduced in Neo4j 2025.06 or later are added only to Cypher 25. Setting the default language to CYPHER 25 ensures that all queries run on that database use the version of Cypher 25 that the database is currently running (unless you prepend your queries with CYPHER 5, which overrides this default). For example, a Neo4j 2025.10 database with default language Cypher 25 will use Cypher 25 as it exists in Neo4j 2025.10, including any changes introduced in Neo4j 2025.06, 2025.07, 2025.08, and 2025.09.

Starting from Neo4j 2026.02,the distributed neo4j.conf explicitly sets db.query.default_language=CYPHER_25. As a result, new deployments using the provided configuration file default to Cypher 25 for newly created databases. The Cypher version can still be explicitly specified in the CREATE DATABASE command or can be changed at any time using ALTER DATABASE.

If you want to use Cypher 5 as the default for new databases, you can remove or comment out that configuration entry, which is equivalent to setting db.query.default_language=CYPHER_5. Existing databases retain their existing default language.

Reading the administration commands syntax

Table 1. Special characters in syntax summaries
Character Meaning Example

|

Used to indicate alternative parts of a command (i.e. or). Needs to be part of a grouping.

If the syntax needs to specify either a name or *, this can be indicated with * | name.

{ and }

Used to group parts of the command. Commonly found together with |.

In order to use the or in the syntax summary, it needs to be in a group: {* | name}.

[ and ]

Used to indicate an optional part of the command. It also groups alternatives together, when there can be either of the alternatives or nothing.

If a keyword in the syntax can either be in singular or plural, you can indicate that the S is optional with GRAPH[S].

...

Repeated pattern. Related to the command part immediately before this is repeated.

A comma separated list of names would be name[, ...].

"

When a special character is part of the syntax itself, surround it with " to indicate this.

To include { in the syntax use "{" { * | name } "}". In this case, you will get either { * } or { name }.

The special characters in the table above are the only ones that need to be escaped using " in the syntax summaries.

Here is an example that uses all the special characters. It grants the READ privilege:

GRANT READ
  "{" { * | property[, ...] } "}"
  ON {HOME GRAPH | GRAPH[S] { * | name[, ...] }}
    [ ELEMENT[S] { * | label-or-rel-type[, ...] }
    | NODE[S] { * | label[, ...] }
    | RELATIONSHIP[S] { * | rel-type[, ...] }]
  TO role[, ...]

Note that this command includes { and } in the syntax, and between them there can be a grouping of properties or the character *. It also has multiple optional parts, including the entity part of the command which is the grouping following the graph name. For details about the graph privilege commands syntax, see Components of the graph privilege commands.

However, there is no need to escape any characters when creating a constraint for a node property. This is because ( and ) are not special characters, and [ and ] indicate that the constraint name and the IF NOT EXISTS parts are optional, and therefore not part of the command.

CREATE CONSTRAINT [constraint_name] [IF NOT EXISTS]
FOR (n:LabelName)
REQUIRE n.propertyName IS NOT NULL

Database management command syntax

The database management commands are used to manage standard or composite databases.

Show databases

Command Syntax

SHOW DATABASE

SHOW { DATABASE[S] name | DATABASE[S] | DEFAULT DATABASE | HOME DATABASE }
[WHERE expression]
SHOW { DATABASE[S] name | DATABASE[S] | DEFAULT DATABASE | HOME DATABASE }
YIELD { * | field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n]
[WHERE expression]
[RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]]

Create a database

Command Syntax

CREATE DATABASE

CREATE DATABASE name [IF NOT EXISTS]
[DEFAULT LANGUAGE CYPHER {5|25}]
[TOPOLOGY n PRIMAR{Y|IES} [m SECONDAR{Y|IES}]]
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]
CREATE OR REPLACE DATABASE name
[DEFAULT LANGUAGE CYPHER {5|25}]
[TOPOLOGY n PRIMAR{Y|IES} [m SECONDAR{Y|IES}]]
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]

[DEFAULT LANGUAGE CYPHER {5|25}] is available from Neo4j 2025.06 onwards.

Command Syntax

CREATE DATABASE

CREATE DATABASE name [IF NOT EXISTS]
[[SET] DEFAULT LANGUAGE CYPHER {5|25}]
[[SET] TOPOLOGY n PRIMAR{Y|IES} [m SECONDAR{Y|IES}]]
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]
CREATE OR REPLACE DATABASE name
[[SET] DEFAULT LANGUAGE CYPHER {5|25}]
[[SET] TOPOLOGY n PRIMAR{Y|IES} [m SECONDAR{Y|IES}]]
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]

[[SET] DEFAULT LANGUAGE CYPHER {5|25}] is available from Neo4j 2025.06 onwards.
[TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] is replaced by [[SET] TOPOLOGY n PRIMAR{Y\|IES} [m SECONDAR{Y\|IES}]] in Cypher 25.

Create a composite database

Command Syntax

CREATE COMPOSITE DATABASE

CREATE COMPOSITE DATABASE name [IF NOT EXISTS]
[DEFAULT LANGUAGE CYPHER {5|25}]
[OPTIONS "{" "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]
CREATE OR REPLACE COMPOSITE DATABASE name
[DEFAULT LANGUAGE CYPHER {5|25}]
[OPTIONS "{" "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]

[DEFAULT LANGUAGE CYPHER {5|25}] is available from Neo4j 2025.06 onwards.

Command Syntax

CREATE COMPOSITE DATABASE

CREATE COMPOSITE DATABASE name [IF NOT EXISTS]
[[SET] DEFAULT LANGUAGE CYPHER {5|25}]
[OPTIONS "{" "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]
CREATE OR REPLACE COMPOSITE DATABASE name
[[SET] DEFAULT LANGUAGE CYPHER {5|25}]
[OPTIONS "{" "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]

[[SET] DEFAULT LANGUAGE CYPHER {5|25}] is available from Neo4j 2025.06 onwards.

Create a sharded property database

Command Syntax

CREATE DATABASE

CREATE DATABASE name [IF NOT EXISTS]
[[SET] DEFAULT LANGUAGE CYPHER {5|25}]
[[SET] GRAPH SHARD {
  [TOPOLOGY n PRIMAR{Y|IES} [m SECONDAR{Y|IES}]]
}]
[SET] PROPERTY SHARD[S] {
  COUNT n [TOPOLOGY m REPLICA[S]]
}
[OPTIONS "{" option: value[, ...] "}"]
[WAIT [n [SEC[OND[S]]]]|NOWAIT]

When creating a sharded property database, the following are created:

  • A virtual sharded property database <name>.

  • A single graph shard with the name <name>-g000.

  • A number of property shards with the name <name>-p<index>, where <index> ranges from 000 to 999. The count property in SET PROPERTY SHARDS specifies the number of property shards.

The CREATE DATABASE command for sharded property databases supports only the seedURI option. See Creating sharded property databases for details.

CREATE OR REPLACE does not replace an existing sharded property database.

Alter a database

Command Syntax

ALTER DATABASE

ALTER DATABASE name [IF EXISTS]
{
SET ACCESS {READ ONLY | READ WRITE} |
SET TOPOLOGY n PRIMAR{Y|IES} [m SECONDAR{Y|IES}] |
SET OPTION option value |
SET DEFAULT LANGUAGE CYPHER {5|25}
}
[WAIT [n [SEC[OND[S]]]]|NOWAIT]
ALTER DATABASE name [IF EXISTS]
REMOVE OPTION option
[WAIT [n [SEC[OND[S]]]]|NOWAIT]

There can be multiple SET OPTION or REMOVE OPTION clauses for different option keys.

SET DEFAULT LANGUAGE CYPHER {5|25} is available from Neo4j 2025.06 onwards.

Alter a composite database

Command Syntax

ALTER DATABASE

ALTER DATABASE name [IF EXISTS]
SET DEFAULT LANGUAGE CYPHER {5|25}
[WAIT [n [SEC[OND[S]]]]|NOWAIT]

Alter a sharded property database

Command Syntax

ALTER DATABASE <name>

ALTER DATABASE name [IF EXISTS]
{
  SET ACCESS {READ ONLY | READ WRITE} |
  SET OPTION option value |
  SET DEFAULT LANGUAGE CYPHER {5|25} |
  SET GRAPH SHARD {
    SET TOPOLOGY ((n PRIMAR{Y|IES}) | (m SECONDAR{Y|IES}))+
  } |
  SET PROPERTY SHARD[S] {
    SET TOPOLOGY n REPLICA[S]
  }
}
[WAIT [n [SEC[OND[S]]]]|NOWAIT]

ALTER DATABASE <graph-shard>

ALTER DATABASE name [IF EXISTS]
SET TOPOLOGY (
  (n PRIMAR{Y|IES}) |
  (m SECONDAR{Y|IES})
)
[WAIT [n [SEC[OND[S]]]] | NOWAIT]

ALTER DATABASE <property-shard>

ALTER DATABASE name [IF EXISTS]
SET TOPOLOGY (
  n REPLICA[S]
)
[WAIT [n [SEC[OND[S]]]] | NOWAIT]

Stop a database

Command Syntax

STOP DATABASE

STOP DATABASE name [WAIT [n [SEC[OND[S]]]]|NOWAIT]

Start a database

Command Syntax

START DATABASE

START DATABASE name [WAIT [n [SEC[OND[S]]]]|NOWAIT]

Delete a database

Command Syntax

DROP DATABASE

DROP [COMPOSITE] DATABASE name [IF EXISTS] [RESTRICT | CASCADE ALIAS[ES]] [{DUMP|DESTROY} [DATA]] [WAIT [n [SEC[OND[S]]]]|NOWAIT]

Database alias management command syntax

The database alias management commands are used to manage local or remote database aliases.

Show aliases

Command Syntax

SHOW ALIAS

SHOW ALIAS[ES] [name] FOR DATABASE[S]
[WHERE expression]
SHOW ALIAS[ES] [name] FOR DATABASE[S]
YIELD { * | field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n]
[WHERE expression]
[RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]]

Lists both local and remote database aliases, optionally filtered on the alias name.

Create a local alias

Command Syntax

CREATE ALIAS

CREATE ALIAS name [IF NOT EXISTS] FOR DATABASE targetName
[PROPERTIES "{" key: value[, ...] "}"]
CREATE OR REPLACE ALIAS name FOR DATABASE targetName
[PROPERTIES "{" key: value[, ...] "}"]

Create a remote alias

Command Syntax

CREATE ALIAS

CREATE ALIAS name [IF NOT EXISTS] FOR DATABASE targetName
AT 'url' USER username PASSWORD 'password'
[DRIVER "{" setting: value[, ...] "}"]
[DEFAULT LANGUAGE CYPHER {5|25}]
[PROPERTIES "{" key: value[, ...] "}"]
CREATE OR REPLACE ALIAS name FOR DATABASE targetName
AT 'url' USER username PASSWORD 'password'
[DRIVER "{" setting: value[, ...] "}"]
[DEFAULT LANGUAGE CYPHER {5|25}]
[PROPERTIES "{" key: value[, ...] "}"]

[DEFAULT LANGUAGE CYPHER {5|25}] is available from Neo4j 2025.06 onwards.

Command Syntax

CREATE ALIAS

CREATE ALIAS name [IF NOT EXISTS] FOR DATABASE targetName
AT 'url' { USER username PASSWORD 'password' | OIDC CREDENTIAL FORWARDING }
[DRIVER "{" setting: value[, ...] "}"]
[DEFAULT LANGUAGE CYPHER {5|25}]
[PROPERTIES "{" key: value[, ...] "}"]
CREATE OR REPLACE ALIAS name FOR DATABASE targetName
AT 'url' { USER username PASSWORD 'password' | OIDC CREDENTIAL FORWARDING }
[DRIVER "{" setting: value[, ...] "}"]
[DEFAULT LANGUAGE CYPHER {5|25}]
[PROPERTIES "{" key: value[, ...] "}"]

[DEFAULT LANGUAGE CYPHER {5|25}] is available from Neo4j 2025.06 onwards.
OIDC CREDENTIAL FORWARDING is available from Neo4j 2026.01 onwards.

Alter a local alias

Command Syntax

ALTER ALIAS

ALTER ALIAS name [IF EXISTS] SET DATABASE
[TARGET targetName]
[PROPERTIES "{" key: value[, ...] "}"]

Alter a remote alias

Command Syntax

ALTER ALIAS

ALTER ALIAS name [IF EXISTS] SET DATABASE
[TARGET targetName AT 'url']
[USER username]
[PASSWORD 'password']
[DRIVER "{" setting: value[, ...] "}"]
[DEFAULT LANGUAGE CYPHER {5|25}]
[PROPERTIES "{" key: value[, ...] "}"]

[DEFAULT LANGUAGE CYPHER {5|25}] is available from Neo4j 2025.06 onwards.

Delete an alias

Command Syntax

DROP ALIAS

DROP ALIAS name [IF EXISTS] FOR DATABASE

Drop either a local or remote database alias.