lando / lando

A development tool for all your projects that is fast, easy, powerful and liberating
https://lando.dev
GNU General Public License v3.0
4.09k stars 545 forks source link

Connection to mysql via socket fails #604

Closed HellPat closed 6 years ago

HellPat commented 6 years ago

Bug Report

Client: Version: 17.09.0-ce API version: 1.32 Go version: go1.8.3 Git commit: afdb6d4 Built: Tue Sep 26 22:40:09 2017 OS/Arch: darwin/amd64

Server: Version: 17.09.0-ce API version: 1.32 (minimum version 1.12) Go version: go1.8.3 Git commit: afdb6d4 Built: Tue Sep 26 22:45:38 2017 OS/Arch: linux/amd64 Experimental: false

Tell us about your .lando.yml

name: project
recipe: laravel

# Configure the laravel recipe
config:

  # See: https://laravel.com/docs/5.4/installation#server-requirements

  # Optionally specify the php version to use.
  #
  # If ommitted this will default to the latest php version supported by laravel.
  # Consult the `php` service to see what versions are available. Note that all
  # such versions may not be supported in Laravel 7 so YMMV.
  #
  # See: https://laravel.com/docs/5.4/installation#server-requirements
  #
  # NOTE: that this needs to be wrapped in quotes so that it is a string
  #
  php: '7.1'

  # Optionally specify whether you want to serve drupal via nginx or apache
  #
  # If ommitted this will default to the latest apache
  #
  # See: https://laravel.com/docs/5.4/installation#web-server-configuration
  #
  via: nginx

  # Optionally specify the location of the webroot relative to your approot.
  # For Laravel this is usually 'public'
  #
  # If ommitted this will be your approot itself.
  #
  webroot: public

Tell us about the command you were running

lando rebuild && lando mysql

Tell us about the error you got

Example:

lando mysql -vvvv

Results in

Starting project_database_1 ...
Starting project_database_1 ... done
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")

Does this bug prevent you from using lando?

Yes, I can't connect to the database

How can I solve this issue, I think this might be a docker problem but could not find any solution :-( (Sorry, I'm a stupid newbie and hoped lando will help me to use docker nevertheless)

serundeputy commented 6 years ago

@psren thanks for the report.

This is working as expected for me. I tried the lando/examples/laravel with mariadb (the default) and with mysql in both cases lando mysql connected me to the DB sever correctly.

Are you using a default laravel install? if not could be something specific to your app configuration.

pirog commented 6 years ago

while not ALWAYS the case this usually happens when you try to switch databases and is documented here https://docs.devwithlando.io/issues/switching-dbs.html

sovetski commented 1 year ago
lando rebuild && lando mysql

Thank you for the link!

This command resolved my issue

lando destroy && lando start