MilVus Database
Table Of Contents:
- What is MilVus Database?
- Create Database.
- Use Database.
- List All Database.
- Drop Database.
(1) What Is MilVus Database?
- Similar to traditional database engines, you can also create databases in Milvus and allocate privileges to certain users to manage them.
- Then such users have the right to manage the collections in the databases.
- A Milvus cluster supports a maximum of 64 databases.
(2) Create Database.
- Step-1: Use connect() to connect to the Milvus server.
- Step-2: and create_database() to create a new database:
from pymilvus import connections, db
conn = connections.connect(host="127.0.0.1", port=19530)
database = db.create_database("my_database")
- The above code snippets connects to the default database and creates a new database named
my_database.
(3) Use Database.
- A Milvus cluster ships with a default database, named ‘default’.
- Collections are created in the default database unless otherwise specified.
- To change the default database, do as follows:
db.using_database("my_database")
- You can also set a database to use upon connecting to your Milvus cluster as follows:
conn = connections.connect(
host="127.0.0.1",
port="19530",
db_name="my_database"
)
(4) List All Database.
- To find all existing databases in your Milvus cluster, use the list_database() method:
db.list_database()
['default', 'my_database']
(5) Drop Database
To drop a database, you have to drop all its collections first.
Otherwise, the drop fails.
To drop a database, use the drop_database() method:
db.drop_database("my_database")
db.list_database()
['default']

