Console - CREATE DATABASE

Creates and connects to a new database.

Syntax

  1. CREATE DATABASE <database-url> [<user> <password> <storage-type> [<db-type>]]
  • <database-url> Defines the URL of the database you want to connect to. It uses the format <mode>:<path>
    • <mode> Defines the mode you want to use in connecting to the database. It can be PLOCAL or REMOTE.
    • <path> Defines the path to the database.
  • <user> Defines the user you want to connect to the database with.
  • <password> Defines the password needed to connect to the database, with the defined user.
  • <storage-type> Defines the storage type that you want to use. You can choose between PLOCAL and MEMORY.
  • <db-type> Defines the database type. You can choose between GRAPH and DOCUMENT. The default is GRAPH.

Examples

  • Create a local database demo:

    1. orientdb> CREATE DATABASE PLOCAL:/usr/local/orientdb/databases/demo
    2.  
    3. Creating database [plocal:/usr/local/orientdb/databases/demo]...
    4. Connecting to database [plocal:/usr/local/orientdb/databases/demo]...OK
    5. Database created successfully.
    6.  
    7. Current database is: plocal:/usr/local/orientdb/databases/demo
    8.  
    9. orientdb {db=demo}>
  • Create a remote database trick:

    1. orientdb> CREATE DATABASE REMOTE:192.168.1.1/trick root
    2. E30DD873203AAA245952278B4306D94E423CF91D569881B7CAD7D0B6D1A20CE9 PLOCAL
    3.  
    4. Creating database [remote:192.168.1.1/trick ]...
    5. Connecting to database [remote:192.168.1.1/trick ]...OK
    6. Database created successfully.
    7.  
    8. Current database is: remote:192.168.1.1/trick
    9.  
    10. orientdb {db=trick}>

To create a static database to use from the server, see Server pre-configured storage types.

To remove a database, see DROP DATABASE. To change database configurations after creation, see ALTER DATABASE.

For more information on other commands, see Console Commands.