Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/helpers/sql-export.sh connects to wrong database #158

Open
tirwin opened this issue May 3, 2022 · 0 comments
Open

/helpers/sql-export.sh connects to wrong database #158

tirwin opened this issue May 3, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@tirwin
Copy link

tirwin commented May 3, 2022

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

@tirwin tirwin added the bug Something isn't working label May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant