命令 - CREATE DATABASE

创建和连接一个新的数据库。

语法

CREATE DATABASE <database-url> [<user> <password> <storage-type> [<db-type>]]
  • <database-url> 数据库的url,格式<mode>:<path>
    • <mode> 数据库的连接模式,PLOCAL或者REMOTE.
    • <path> 定义数据库的路径
  • <user> 定义连接使用的用户名
  • <password> 用户名对应的密码
  • <storage-type> 定义数据库的类型。PLOCAL或者MEMORY
  • <db-type> 定义数据库的类型。GRAPH或者DOCUMENT。默认GRAPH

例子

  • 创建本地数据库demo:

    orientdb> CREATE DATABASE PLOCAL:/usr/local/orientdb/databases/demo
    
    Creating database [plocal:/usr/local/orientdb/databases/demo]...
    Connecting to database [plocal:/usr/local/orientdb/databases/demo]...OK
    Database created successfully.
    
    Current database is: plocal:/usr/local/orientdb/databases/demo
    
    orientdb {db=demo}>
    
  • 创建远程数据库trick:

    orientdb> CREATE DATABASE REMOTE:192.168.1.1/trick root 
              E30DD873203AAA245952278B4306D94E423CF91D569881B7CAD7D0B6D1A20CE9 PLOCAL
    
    Creating database [remote:192.168.1.1/trick ]...
    Connecting to database [remote:192.168.1.1/trick ]...OK
    Database created successfully.
    
    Current database is: remote:192.168.1.1/trick
    
    orientdb {db=trick}>
    

>

删除数据库DROP DATABASE。变更数据库ALTER DATABASE.

更多其他命令,参考Console Commands.