当前位置: 首页 > 教程 > OrientDB >

OrientDB列出数据库

精华
小牛编辑
89浏览
2023-03-14

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

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

LIST DATABASES

注 - 只有在连接到本地或远程服务器后,才能使用此命令。

示例

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

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

orientdb> connect remote:localhost guest

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

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

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

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

如果它成功执行,将获得以下输出 -

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