Search code examples
memgraphdb

What is the fastest way to import data into Memgraph from MySQL database?


I have a rather large dataset (a few million nodes and relationships) in the MySQL database. I want to import that data into Memgraph. What is the fastest way to do the import?


Solution

  • For data migration from MySQL to memgraph you can use the tool called mgmigrate. This tool can be used for migration from running instances of MySQL and PostgreSQL. The bonus is that you can also use it for data migration between Memgraph instances.

    To do the migration you need

    • mgmigrate tool
    • A running PostgreSQL instance with the database you wish to migrate.
    • A running Memgraph instance where you want to migrate the data.

    Once you have everything in place you can use this code for migration:

    build/src/mgmigrate --source-kind=mysql /
      --source-host 127.0.0.1 /
      --source-port 33060 /
      --source-username root /
      --source-password mysql /
      --source-database=exampledatabase /
      --destination-host 127.0.0.1 /
      --destination-port 7687 /
      --destination-use-ssl=false
    

    The documentation is on the GitHub repo and the Memgraph website.