Install and connect

Install Memgraph Lab and connect to a database

We recommend you use the Memgraph Platform and get the complete streaming graph application platform that includes:

  • Memgraph - the database that holds your data
  • Memgraph Lab - visual user interface for running queries and visualizing graph data
  • mgconsole - command-line interface for running queries
  • MAGE - graph algorithms and modules library

After running the image, mgconsole will open in the terminal while Memgraph Lab is available on http://localhost:3000.

If you want to install Memgraph Lab as a desktop application, check out the installation instructions for Windows, macOS and Linux, and if you have a public Memgraph database instance you can access the Lab web application at https://lab.memgraph.com/ (opens in a new tab).

Install Memgraph Lab desktop application

Download and install Memgraph

Memgraph Lab requires a running Memgraph database instance.

If you installed Memgraph using Docker and wish to connect to it with the Memgraph Lab desktop application, ensure that ports 7687, used for instance connections (-p 7687:7687), and 7444, used for logs (-p 7444:7444), are exposed in the docker run ... command.

Connecting Memgraph Lab to Memgraph may vary depending on the deployment method or operating system. The handling of the QUICK_CONNECT_MG_HOST environment variable varies by operating system.

Download Memgraph Lab

Visit the Download Hub (opens in a new tab) and download the Memgraph Lab desktop application.

Install Memgraph Lab

You can install Memgraph Lab by double clicking the downloaded installer and following the instructions.

If you downloaded Memgraph Lab on Linux, you can execute:

sudo dpkg -i MemgraphLab-x.x.x.deb
💡

If you encounter a security warning while installing Memgraph Lab on Windows, you may see a message similar to the ones shown in the images below.

  1. Click More info.

  2. Verify that Memgraph is listed as the Publisher.

  1. Click Run anyway to proceed with the installation of Memgraph Lab.

Set up connection

After starting Memgraph Lab, you will see the login screen. Follow these steps to connect:

  1. Click on "New connection" in the sidebar.
  2. Select "Memgraph instance: Connect to a standalone instance". Feel free to check other connections types.

Now, input the connection information:

  • Host: Enter localhost, host.docker.internal, 127.0.0.1, 0.0.0.0, or modify it as needed.
  • Port: Enter 7687, which Memgraph uses by default.
  • Database name: Leave empty unless connecting to a multi-tenant Memgraph instance.
  • Logs port: Default is 7444, the port for the web socket logs.
  • Encrypted: Ensure this option is disabled by default. Enable it if your Memgraph has SSL enabled.

Connect

Click on Connect, and you should be presented with the following dashboard:

lab-dashboard

Congratulations! You have successfully installed Memgraph Lab and connected it to Memgraph. You are now ready to start building your graph and querying it.

⚠️

You might receive the following error message when trying to connect.

failed_connection

In this case, make sure that Memgraph is properly up and running and that you have entered the correct port number.

Execute queries

Now, you can execute Cypher queries on Memgraph. Open the Query tab, located in the left sidebar, copy the following query and press the Run query button:

CREATE (u:User {name: "Alice"})-[:Likes]->(m:Software {name: "Memgraph"});

The query above will create 2 nodes in the database, one labeled "User" with name "Alice" and the other labeled "Software" with name "Memgraph". It will also create a relationship that "Alice" likes "Memgraph".

To find created nodes and relationships, execute the following query:

MATCH p=()-[]->() RETURN p;

You should get the following result:

graph_result

Run Memgraph Lab with Docker

Run the Memgraph Lab Docker image using the following command:

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

Once the container is up you can access Memgraph Lab on localhost:3000 (opens in a new tab).

Issues when connecting to Memgraph

Memgraph Lab detects if Memgraph is running on localhost:7687 by default for the Quick Connect. The environment variables that are responsible for Quick Connect working as expected are QUICK_CONNECT_MG_HOST, QUICK_CONNECT_MG_PORT and QUICK_CONNECT_MG_IS_ENCRYPTED. The handling of the QUICK_CONNECT_MG_HOST environment variable differs based on the operating system:

  • Mac or Windows: The host.docker.internal hostname allows Docker containers to connect to the host machine. Set this as the value for QUICK_CONNECT_MG_HOST when running Lab on Mac or Windows to enable connection to Memgraph running on the host:

    docker run -d -p 3000:3000 -e QUICK_CONNECT_MG_HOST=host.docker.internal --name lab memgraph/lab
  • Linux: There's no need to set QUICK_CONNECT_MG_HOST as it defaults to localhost, assuming Memgraph is running locally on the host machine.

You can also use the QUICK_CONNECT_MG_PORT environment variable to specify the quick connect port number, e.g. - e QUICK_CONNECT_MG_PORT=7688.

💡

To connect to a running Memgraph instance, you don't need to set QUICK_CONNECT_MG_HOST to host.docker.internal. Instead, create a new connection in Memgraph Lab and specify host.docker.internal as the Host.

Setting host.docker.internal as the Host

Environment variables

The desktop application version of Memgraph Lab does not support receiving environment variables.

Configure Memgraph Lab using the following environment variables when running it through Docker, including Docker Compose:

VariableDescriptionTypeDefault
AUTH_NATIVE_IS_DISABLEDEnable or disable native authentication (username, password)booleanfalse
AUTH_OIDC_ENTRA_ID_IS_ENABLEDEnable or disable Entra ID SSO authentication via OIDCbooleanfalse
AUTH_OIDC_ENTRA_ID_DISPLAY_NAMEEntra ID OIDC display name "Sign in with <name>"string"Entra ID"
AUTH_OIDC_ENTRA_ID_ISSUEREntra ID OIDC issuerstring
AUTH_OIDC_ENTRA_ID_AUTHORIZATION_URLEntra ID OIDC authorization URLstring
AUTH_OIDC_ENTRA_ID_TOKEN_URLEntra ID OIDC token URLstring
AUTH_OIDC_ENTRA_ID_USER_INFO_URLEntra ID OIDC user info URLstring
AUTH_OIDC_ENTRA_ID_CLIENT_IDEntra ID OIDC client IDstring
AUTH_OIDC_ENTRA_ID_CLIENT_SECRETEntra ID OIDC client secretstring
AUTH_OIDC_ENTRA_ID_CALLBACK_URLEntra ID OIDC callback URLstring
AUTH_OIDC_ENTRA_ID_SCOPEEntra ID OIDC scopestring"openid profile"
AUTH_OIDC_OKTA_IS_ENABLEDEnable or disable Okta SSO authentication via OIDCbooleanfalse
AUTH_OIDC_OKTA_DISPLAY_NAMEOkta OIDC display name "Sign in with <name>"string"Okta"
AUTH_OIDC_OKTA_ISSUEROkta OIDC issuerstring
AUTH_OIDC_OKTA_AUTHORIZATION_URLOkta OIDC authorization URLstring
AUTH_OIDC_OKTA_TOKEN_URLOkta OIDC token URLstring
AUTH_OIDC_OKTA_USER_INFO_URLOkta OIDC user info URLstring
AUTH_OIDC_OKTA_CLIENT_IDOkta OIDC client IDstring
AUTH_OIDC_OKTA_CLIENT_SECRETOkta OIDC client secretstring
AUTH_OIDC_OKTA_CALLBACK_URLOkta OIDC callback URLstring
AUTH_OIDC_OKTA_SCOPEOkta OIDC scopestring"openid profile"
AUTH_SAML_ENTRA_ID_IS_ENABLEDEnable or disable Entra ID SSO authentication via SAMLbooleanfalse
AUTH_SAML_ENTRA_ID_DISPLAY_NAMEEntra ID SAML display name "Sign in with <name>"string"Entra ID"
AUTH_SAML_ENTRA_ID_ENTRY_POINTEntra ID SAML entry pointstring
AUTH_SAML_ENTRA_ID_CALLBACK_URLEntra ID SAML callback URLstring
AUTH_SAML_ENTRA_ID_APP_IDEntra ID SAML application IDstring
AUTH_SAML_ENTRA_ID_SIGNATURE_ALGORITHMEntra ID SAML signature algorithmstring"sha256"
AUTH_SAML_OKTA_IS_ENABLEDEnable or disable Okta SSO authentication via SAMLbooleanfalse
AUTH_SAML_OKTA_DISPLAY_NAMEOkta SAML display name "Sign in with <name>"string"Okta"
AUTH_SAML_OKTA_ENTRY_POINTOkta SAML entry pointstring
AUTH_SAML_OKTA_CALLBACK_URLOkta SAML callback URLstring
AUTH_SAML_OKTA_ISSUEROkta SAML issuerstring
AUTH_SAML_OKTA_SIGNATURE_ALGORITHMOkta SAML signature algorithmstring"sha256"
ENTERPRISE_LICENSE_ORG_NAMEEnterprise license organization name. Refer to documentation for details on obtaining and configuring the licensestring
ENTERPRISE_LICENSE_KEYEnterprise license key. Refer to documentation for details on obtaining and configuring the licensestring
KEEP_ALIVE_TIMEOUT_MSMax time in milliseconds during which Lab will hold the connectioninteger65000
LOG_LEVELSet the log level: debug, info, warn, error.string"info"
LOG_IS_ENABLEDEnable or disable loggingbooleantrue
LOG_IS_PRETTY_PRINTPretty print logs and error stacktraces in multi-line JSON formatbooleantrue
LOG_CONTEXT_IS_ENABLEDEnable or disable logging of context information (e.g., identifiers, input data, output data)booleanfalse
LOG_STACKTRACE_IS_ENABLEDEnable or disable error stacktraces in the logsbooleanfalse
MODULE_CONTENT_MAX_LENMax length of a query module contentinteger50000
MODULE_NAME_MAX_LENMax length of the query module nameinteger1000
MODULE_VALIDATION_IS_ENABLEDState of module validationbooleanfalse
NODE_LABEL_MAX_LENMax length of the node labelinteger1000
NODE_LABEL_VALIDATION_IS_ENABLEDState of node label validationbooleanfalse
NODE_PROPERTY_MAX_LENMax length of the node propertyinteger1000
NODE_PROPERTY_VALIDATION_IS_ENABLEDState of node property validationbooleanfalse
QUERY_MAX_LENMax length of a Cypher queryinteger5000
QUERY_VALIDATION_IS_ENABLEDState of query validationbooleanfalse
QUICK_CONNECT_IS_DISABLEDState of quick connect featurebooleanfalse
QUICK_CONNECT_MG_HOSTHost address for quick connectstring"127.0.0.1"
QUICK_CONNECT_MG_PORTPort for quick connectinteger7687
QUICK_CONNECT_MG_IS_ENCRYPTEDTurn SSL on/off for quick connectbooleanfalse
PORTLab app default listening portinteger3000
REQUEST_BODY_LIMIT_MBLimit for request body size in MBinteger20
SSL_IS_ENABLEDEnable or disable SSLbooleanfalse
SSL_CERT_PATHPath to SSL certificate to be usedstring./ssl/cert.pem
SSL_KEY_PATHPath to SSL key to be usedstring./ssl/key.pem
STORAGE_MG_HOST(Enterprise only) Memgraph host for the Lab remote storagestring
STORAGE_MG_PORT(Enterprise only) Memgraph port for the Lab remote storagenumber
STORAGE_MG_IS_ENCRYPTED(Enterprise only) Memgraph SSL on/off for the Lab remote storageboolean
STORAGE_MG_DATABASE_NAME(Enterprise only) Memgraph database name for the Lab remote storagestring
STORAGE_MG_USERNAME(Enterprise only) Memgraph username for the Lab remote storagestring
STORAGE_MG_PASSWORD(Enterprise only) Memgraph password for the Lab remote storagestring
STORAGE_MG_CONNECT_TIMEOUT_MS(Enterprise only) Connection timeout in milliseconds for remote storageinteger10000
STREAM_NAME_MAX_LENMax length of the stream nameinteger500
STREAM_VALIDATION_IS_ENABLEDState of stream validationbooleanfalse

When running Memgraph Lab using Docker, configure the environment variables to adjust settings. Use the Docker run command as follows to set these variables:

docker run -d -p 3000:3000 --name lab -e QUERY_MAX_LEN=10000 -e MODULE_NAME_MAX_LEN=2500 memgraph/lab

For Docker Compose, define the same environment variables within the environment section of your service configuration in the docker-compose.yml file:

environment:
  - QUERY_MAX_LEN=10000
  - MODULE_NAME_MAX_LEN=2500