Neo4j: Databases Cheat Sheet

Listing databases

SHOW { DATABASE db | DATABASES | DEFAULT DATABASE }
    [YIELD field1[, field2] [ORDER BY field1 [, field2]] [SKIP n] [LIMIT n]]
    [WHERE expression]

A particular database can be seen using the command SHOW DATABASE name.

The default database can be seen using the command SHOW DEFAULT DATABASE.

Creating databases

CREATE DATABASE customers

Appending IF NOT EXISTS to the command will ensure that no exception is thrown and nothing happens should the database already exist.

CREATE DATABASE customers IF NOT EXISTS

Adding OR REPLACE to the command will result in any existing database being deleted and a new one created.

CREATE OR REPLACE DATABASE customers

Stopping databases 

STOP DATABASE customers

Starting databases 

START DATABASE customers

Deleting databases 

DROP DATABASE customers

Leave a Reply

Your email address will not be published. Required fields are marked *