Getting Started with Memgraph

Memgraph is a high-performance, in-memory graph database designed for real-time analytics on connected data. It uses the Cypher query language and supports ACID transactions, making it suitable for use cases like fraud detection, recommendation systems, network analysis, and more. Built to handle dynamic and complex data relationships efficiently, Memgraph integrates seamlessly with streaming platforms and provides tools like Memgraph Lab for visual exploration, empowering developers and data scientists to derive insights from graph data quickly and intuitively.

🧱 1. Launch Memgraph with Docker

Run Memgraph with built-in graph algorithms via MAGE:

docker run -p 7687:7687 -p 7444:7444 --name memgraph memgraph/memgraph-mage
  • Port 7687: Bolt protocol for applications/CLI.
  • Port 7444: HTTP log streaming to Memgraph Lab. (memgraph.com, memgraph.com)

🛠️ 2. Connect via CLI

Access the Memgraph container and start the interactive Cypher CLI:

docker exec -it memgraph mgconsole

This gives you direct access to your running database. (memgraph.com

🎨 3. Use Memgraph Lab (GUI)

Option A: via Docker

docker run -d -p 3000:3000 --name lab memgraph/lab

Then open http://localhost:3000 in your browser.

Option B: standalone app
Download and install Memgraph Lab separately, then connect to your Memgraph instance.

📦 4. Explore Docker Image Variants

  • memgraph/memgraph-mage: Includes database + MAGE algorithms.
  • memgraph/memgraph: Database + CLI only (no pre-loaded algorithms). (memgraph.com)

Use the “mage” image unless you need a leaner setup.

📊 5. (Optional) Multi‑Container Setup with Docker Compose

Create a docker-compose.yml like this:

services:
  memgraph:
    image: memgraph/memgraph-mage:latest
    container_name: memgraph-mage
    pull_policy: always
    volumes:
      - mg_lib:/var/lib/memgraph
      - mg_log:/var/log/memgraph
    ports:
      - "7687:7687"
      - "7444:7444"
    command: ["--log-level=TRACE"]

  lab:
    image: memgraph/lab:latest
    container_name: memgraph-lab
    pull_policy: always
    ports:
      - "3000:3000"
    depends_on:
      - memgraph
    environment:
      - QUICK_CONNECT_MG_HOST=memgraph
      - QUICK_CONNECT_MG_PORT=7687

volumes:
  mg_lib:
  mg_log:
  mg_etc:

Then start both services with:

docker-compose up

This sets up Memgraph and Lab as a unified development environment. (memgraph.com, memgraph.com)

⚙️ 6. Customize via Configuration Flags

You can tweak runtime settings directly:

docker run memgraph/memgraph \
  --bolt-port=7687 \
  --log-level=TRACE

This allows you to adjust log verbosity, ports, etc., on the fly.

✅ Summary Checklist

  1. Pull and run the Docker image.
  2. Connect using CLI (mgconsole) or Lab.
  3. (Optional) Use Docker Compose for multi-container setups.
  4. Customize via command-line flags as needed.