/helpers/sql-export.sh connects to wrong database
- Dominant language
- JavaScript
- Stars
- 7
- Forks
- 5
- Avg merge
- 1h 17m
- Merged PRs (30d)
- 3
Description
My steps:
- platform get --> clone a project
- cd to root of project
- lando init --source cwd --recipe platformsh
- lando start --> builds just fine
- browse to local site, execute Drupal (Paragon distribution) setup --> creates the database "main"
- platform db:dump --> creates a sql script to build a copy of production database
- lando database main -e "source .sql" --> import into the database main
- [perform some work]
- [add tooling config to expose sql-export: see below]
- lando db-export
- ERROR:
Preparing to export database.2022-05-03-1651596318.sql from database 'database' on service 'db' as user root...
mysqldump: Got error: 1045: "Access denied for user 'root'@'localhost' (using password: NO)" when trying to connect
Failed to create file: database.2022-05-03-1651596318.sql
In the tooling config I had to change the name of the SERVICE from "database" to "db" as this was the service that the recipe (or the Drupal Setup routine) created.
The name of the DATABASE running in the "db" service is "main".
Is there an option to configure the name of the database used by the /helpers/sql-export.sh script uses? (If I edit the script directly, it is overwritten.)
I feel I'm missing something elementary.
Here is the tooling I added to my .lando.yml. Is there a config element to add here to specify database name?
name: XXXXXXXXXX
recipe: platformsh
config:
id: XXXXXXXXXXXX
tooling:
'db-export [file]':
service: :host
description: Exports database from a database service to a file
cmd: /helpers/sql-export.sh
user: root
database: main
options:
host:
description: The database service to use
default: db
alias:
- h
stdout:
description: Dump database to stdout
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading /helpers/sql-export.sh and the db-export tooling definition shown in the issue, then run lando db-export against the configured db service and main database. Trace how the service, database, and credentials are passed to the helper; done is an export of main without editing the generated helper script.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, shell
- Domain
- databases, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100