Orientdb 简明教程
OrientDB - Connect Database
本章解释如何通过 OrientDB 命令行连接到特定数据库。它打开一个数据库。
This chapter explains how to connect to a particular database from the OrientDB command line. It opens a database.
以下是连接命令的基本语法。
The following statement is the basic syntax of the Connect command.
CONNECT <database-url> <user> <password>
以下是上文中选项的详细信息。
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.
Example
在之前的章节中,我们已经创建了一个名为“demo”的数据库。在此示例中,我们将使用用户管理员连接到它。
We have already created a database named ‘demo’ in the previous chapters. In this example, we will connect to that using the user admin.
可以使用以下命令连接到 demo 数据库。
You can use the following command to connect to demo database.
orientdb> CONNECT PLOCAL:/opt/orientdb/databases/demo admin admin
如果成功连接,您将获得以下输出 -
If it is successfully connected, you will get the following output −
Connecting to database [plocal:/opt/orientdb/databases/demo] with user 'admin'…OK
Orientdb {db = demo}>