Orientdb 简明教程
OrientDB - Create Database
OrientDB 数据库的 SQL 参考提供了多个命令,用于创建、修改和删除数据库。
The SQL Reference of the OrientDB database provides several commands to create, alter, and drop databases.
以下语句是 Create Database 命令的基本语法。
The following statement is a basic syntax of Create Database command.
CREATE DATABASE <database-url> [<user> <password> <storage-type> [<db-type>]]
以下是上文中选项的详细信息。
Following are the details about the options in the above syntax.
<database-url> - 定义数据库的 URL。URL 包含两部分,一部分是 <mode>,另一部分是 <path>。
<database-url> − Defines the URL of the database. URL contains two parts, one is <mode> and the second one is <path>.
<mode> - 定义模式,即本地模式或远程模式。
<mode> − Defines the mode, i.e. local mode or remote mode.
<path> - 定义到数据库的路径。
<path> − Defines the path to the database.
<user> - 定义连接到数据库的用户。
<user> − Defines the user you want to connect to the database.
<password> - 定义用于连接到数据库的密码。
<password> − Defines the password for connecting to the database.
<storage-type> - 定义存储类型。可以在 PLOCAL 和 MEMORY 中进行选择。
<storage-type> − Defines the storage types. You can choose between PLOCAL and MEMORY.
Example
可以使用以下命令创建一个名为 demo 的本地数据库。
You can use the following command to create a local database named demo.
Orientdb> CREATE DATABASE PLOCAL:/opt/orientdb/databses/demo
如果数据库创建成功,将获得以下输出。
If the database is successfully created, you will get the following output.
Database created successfully.
Current database is: plocal: /opt/orientdb/databases/demo
orientdb {db = demo}>