Manage Metadata with MySQL

By default, Milvus uses SQLite for metadata management because it is easy to use, robust, and requires no additional services. However, we still recommend using MySQL in a production environment for improved reliability.

In CentOS, Milvus does not support MySQL 8.0 or higher.

Follow the steps below to use MySQL as metadata management service in Linux:

  1. Pull the latest image of MySQL:

    $ docker pull mysql:5.7
  2. Launch MySQL service. You can set your own password and port.

    $ docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7
  3. Use root account and the IP of the host that runs MySQL service (<MySQL_server_host IP>) to log in MySQL. Press <ENTER> to enter the password you set in the previous step.

    $ mysql -h<MySQL_server_host IP> -uroot -p
  4. Enter MySQL client command line interface to create a database. Here we use milvus as the database name.

    mysql> create database milvus;
  5. Quit MySQL client and update the meta_uri parameter in server_config.yaml. Use the IP of the host that runs MySQL service (<MySQL_server_host IP>). Note that the password, IP address, port, and database name must be consistent with your previous settings.

    meta_uri: mysql://root:123456@<MySQL_server_host IP>:3306/milvus
  6. Use the updated server_config.yaml to launch Milvus.


Why does Milvus return database is locked? If you use SQLite to manage metadata, you receive this error message when write requests occur frequently. We recommend using MySQL for metadata management. See Manage Metadata with MySQL for more information.
Why can't I find vectors on SQLite or MySQL? Milvus stores vectors and indexes directly in the disk as files, not in SQLite or MySQL. It uses SQLite or MySQL to store metadata of the vectors instead. See Storage Concepts for more information.
Can I use SQL Server or PostgreSQL to store metadata in Milvus? No, we only support storing metadata using SQLite or MySQL.

From data import, data storage to data querying and scheduling, our blogs on Medium provide detailed insights into the data management mechanism of Milvus.

On this page