Development

Setting a Specific External Port for MySQL in Lando

Lando sets an external MySQL port dynamically by default. This means every time you (re)start a lando app it gets (potentially) a different external MySQL port. This is an annoyance as you have to change your port in TablePlus, SequelPro, or whatever MySQL GUI you’re using.

There is a simple fix: use a local lando file to override the forwarded MySQL port. These steps assume you already have a working .lando.yml file.

Step 1: Create a local lando file: .lando.local.yml

Step 2: Run lando rebuild if you’ve already started the site in the past

Step 3: Verify the settings by running lando info

Step 4: Add .lando.local.yml to your .gitignore  file

This site will always get the port you specified if it’s available when you start the app. You can use this port in your MySQL gui, scripts, etc.

Leave a Reply

Your email address will not be published.