Monday 5 July 2021

ArangoDB: change to other database

‘db._useDatabase(name)’ statement is used to change the database.

 

Step 1: Login to arango shell.

$arangosh
Please specify a password: 

                                       _     
  __ _ _ __ __ _ _ __   __ _  ___  ___| |__  
 / _` | '__/ _` | '_ \ / _` |/ _ \/ __| '_ \ 
| (_| | | | (_| | | | | (_| | (_) \__ \ | | |
 \__,_|_|  \__,_|_| |_|\__, |\___/|___/_| |_|
                       |___/                 

arangosh (ArangoDB 3.7.11 [darwin] 64bit, using build , VPack 0.1.33, RocksDB 6.8.0, ICU 64.2, V8 7.9.317, OpenSSL 1.1.1k  25 Mar 2021)
Copyright (c) ArangoDB GmbH

Command-line history will be persisted when the shell is exited. You can use `--console.history false` to turn this off
Connected to ArangoDB 'http+tcp://127.0.0.1:8529, version: 3.7.11 [SINGLE, server], database: '_system', username: 'root'

Type 'tutorial' for a tutorial or 'help' to see common examples
127.0.0.1:8529@_system>

 

Step 2: Execute the statement ‘db._databases();’ to list all the databases.

127.0.0.1:8529@_system> db._databases();
[ 
  "_system", 
  "demodb", 
  "example" 
]

 

Step 3: Switch to the ‘example‘ database.

127.0.0.1:8529@_system> db._useDatabase("example")
true

127.0.0.1:8529@example>

When you switch the database in arangosh, current credentials are reused.

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment