search: keywords: ['SQL', 'command', 'create', 'database', 'CREATE DATABASE']

Server Commands - CREATE DATABASE

Creates a database on the current environment/server

Syntax

CREATE DATABASE foo plocal users (foo identified by 'pippo' role admin, reader identified by ? role [reader, writer])

CREATE DATABASE <dbName> <type> [ USERS (<username> IDENTIFIED BY <password> ROLE <roleName>)*] [<configJson>]
  • <dbName> The database name
  • <type> plocal or memory
  • <username> the name of a user to add to the database
  • <password> the password of a user to add to the database
  • <roleName> the name of a role to assign to the user added to the database
  • <configJson> the custom configuration for current db

Examples

  • Create a DB:

    orientdb> CREATE DATABASE foo plocal
    
  • Create a DB with custom users:

    orientdb> CREATE DATABASE foo plocal users (foo identified by 'pippo' role admin, reader identified by ? role [reader, writer])
    
  • Create a DB with legacy default users:

    orientdb> CREATE DATABASE foo plocal {"config":{"security.createDefaultUsers": true}}