2

How to dump the database to local system from Magento Cloud server with Magento 2 Commerce. I have only access to the ssh but that ssh user doesn't have write permission into the server. So by any how I need to download the database to the local system.

I have also tried to run the below command in my local system:

mysqldump -h hostname -u username -p dbname> dbname.sql

Hostname I used same as ssh host because I found 127.0.0.1 as db host on app/etc/env.php. But unfortunately it doesn't help.

I have checked this Magento 2 Commerce cloud database export but I dont know how to use this?

Is ece-tools db-dump already available in Magento cloud? Or we need to install it? If I need to install it then I cannot do this as there is no write permission is there in the server. I can only use git.

Is there any other way to do this Or How can I achieve this?

nikin
1,1529 silver badges19 bronze badges
asked Jan 10, 2020 at 18:43

4 Answers 4

11
  1. Install magento-cloud cli

  2. Get a project and environment with the magento-cloud cli

  3. Run command to go into the current environment, dump the file, and then download it to your local computer

    • magento-cloud db:dump
answered Jan 10, 2020 at 19:51
3
  • 1
    This is very bad idea, as magento-cloud dump also exports the views with original owner, so access to most of tables will be non accessible. BTW Magento does not reccomend using it on a cloud see support.magento.com/hc/en-us/articles/… Commented Sep 18, 2020 at 7:41
  • Once you have the dump file you have to make sure to remove the definer: zcat ${backupFilePath} | sed -e 's/DEFINER[ ]*=[ ]*[^*]**/*/' Commented Sep 9, 2021 at 1:11
  • For my own personal script i use magerun to dump the db and also strip any sensitive data, then i download the dump from the server. ece-tools doesn't allow you to do that, neither does the magento-cloud tool. Commented Sep 9, 2021 at 1:16
2

ece-tools is available in magneto 2 . You can just refer link https://devdocs.magento.com/cloud/reference/ece-tools-reference.html

answered Jan 10, 2020 at 19:04
2

just install magento cloud cli and then

magento-cloud db:dump
answered Nov 11, 2020 at 20:06
0

Like @Carlos Reynosa said, it worked.

While installing magento-cloud cli through git bash, I got the error saying

stdin is not a tty
curl: (23) Failed writing body (343 != 7113)

then I tried the following to install magento-cloud in local

$ curl -sS https://accounts.magento.cloud/cli/installer -o cli-installer.php
$ php cli-installer.php
  1. Get into appropriate project and environment
  2. Run the command magento-cloud db:dump
answered Sep 5, 2020 at 18:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.