Orientdb 简明教程

OrientDB - List Database

本章介绍如何从 OrientDB 命令行获取实例中所有数据库的列表。

This chapter explains how to get the list of all databases in an instance from the OrientDB command line.

以下语句是 info 命令的基本语法。

The following statement is the basic syntax of the info command.

LIST DATABASES

Note − 你只能在连接到本地或远程服务器后才能使用此命令。

Note − You can use this command only after connecting to a local or remote server.

Example

在检索数据库列表之前,我们必须通过远程服务器连接到本地主机服务器。需要提醒的是,连接到本地主机实例的用户名和密码分别是 guest 和 guest,这已在 orintdb/config/orientdb-server-config.xml 文件中配置。

Before retrieving the list of databases, we have to connect to the localhost server through the remote server. It is required to remind that the username and password for connecting to the localhost instance is guest and guest respectively, which is configured in the orintdb/config/orientdb-server-config.xml file.

可使用以下命令连接到 localhost 数据库服务器实例。

You can use the following command to connect to the localhost database server instance.

orientdb> connect remote:localhost guest

它将询问密码。根据配置文件,guest 的密码也是 guest。如果已成功连接,你将获得以下输出。

It will ask the password. As per the config file password for guest is also guest. If it is successfully connected, you will get the following output.

Connecting to remote Server instance [remote:localhost] with user 'guest'...OK
orientdb {server = remote:localhost/}>

连接到 localhost 数据库服务器后,可使用以下命令列出数据库。

After connecting to the localhost database server you can use the following command to list the databases.

orientdb {server = remote:localhost/}> list databases

如果已成功执行,你将获得以下输出:

If it is successfully executed, you will get the following output −

Found 6 databases:
* demo (plocal)
* s2 (plocal)
* s1 (plocal)
* GratefulDeadConcerts (plocal)
* s3 (plocal)
* sample (plocal)
orientdb {server = remote:localhost/}>