MySQL is a very common database server. You can easily add it to your Lando app by adding an entry to the services key in your app's .lando.yml.

Supported versions

Be Careful Switching Database Type or Version

You should be careful switching database types or versions as the underlying database files between these things may not be compatible. Ignoring this warning can cause your database service to not start correctly!!!

You can read more about this here


# The name of the app
name: mysql

# Give me and

# Set up my services

  # Set up a basic webserver running the latest nginx with ssl turned on
    type: nginx
    ssl: true
    webroot: www

  # Spin up a mariadb container called "database"
  # NOTE: "database" is arbitrary, you could just as well call this "db" or "kanye"

    # Use the latest version of mysql
    type: mysql

    # Optionally forward out our port so we can access it at `localhost:someport`.
    # This port will change every time you restart this app
    # You can also set this to a static port you want to use `portforward:3311`.
    # You will need to make sure the port is open and avialable
    portforward: true

    # Optionally change the default db credentials
    # creds:
      # user: mysql
      # password: mysql
      # database: mysql

    # Optionally load in all the mysql config files in the config directory
    # This is relative to the app root
    # config:
    #  confd: config

You will need to rebuild your app with lando rebuild to apply the changes to this file. You can check out the full code for this example over here.

Getting information

You can get connection and credential information about your database by running lando info from inside your app.

# Navigate to the app
cd /path/to/app

# Get info (app needs to be running to get this)
lando info

  "appserver": {
    "type": "nginx",
    "version": "latest",
    "urls": [
  "db": {
    "type": "mysql",
    "version": "latest",
    "creds": {
      "user": "mysql",
      "password": "password",
      "database": "database"
    "internal_connection": {
      "host": "db",
      "port": 3306
    "external_connection": {
      "host": "localhost",
      "port": true

results matching ""

    No results matching ""