I am on Ubuntu 20.04
and lando 3.6.1
. I have a WordPress site setup with lando. Everything is fine except that I am unable to import the SQL dump using the following command:
$ lando db-import ucoh-data.sql
The dump is placed at the root of the lando application.
When running from a command window (CLI):
chown: cannot access '/app/ucoh-data.sql': No such file or directory
When running inside a PHPStorm terminal:
lando db-import ucoh-data.sql
Lando should never ever ever be run as root...
___ __ ______
/ (_) /_____ ___ _ _____ ____/ / / /
/ / / '_/ -_) / -_) |/ / -_) __/_/_/_/
/_/_/_/\_\\__/ \__/|___/\__/_/ (_|_|_)
Process finished with exit code 77 at 18:21:33.
Execution time: 252 ms.
According to https://stackoverflow.com/a/66198677/1496518 The exit code 77 means Permission Deined. I cannot understand which particular area could be responsible for this permission thing!
I tried to find a solution in Google for nearly 2 hours but could not find anything really useful, especially for the version of Ubuntu Iam currently using.
UPDATE:
The permission for /usr/share/lando
directory in my PC is
rwxr-xr-x 4 root root 4096 Nov 10 18:17 lando
I experienced a similar issue with a Lando Drupal install.
I resolved it by adding the database import command directly into my .lando.yml "tooling" (per Lando Docs https://docs.lando.dev/guides/db-import.html):
tooling:
'db-import <file>':
service: :host
description: Imports a dump file into a database service
cmd: /helpers/sql-import.sh
user: root
options:
host:
description: The database service to use
default: database
alias:
- h
no-wipe:
description: Do not destroy the existing database before an import
boolean: true
Then I ran lando rebuild
.
After that I was able to import my database with no errors.