3

I've just setup the DevBox (Beta) with an install of Magento 2 by running through their wizard and executing the install script.

Everything appears to have worked fine, but I can't figure out any method to connect to and export the database.

No instructions on how to do this are given in the official documentation: http://devdocs.magento.com/guides/v2.1/install-gde/docker/docker-over.html

I want to be able to export my dev database so I can import into my production instance. There must be some way to do this, or developing in DevBox would make no sense!

5
$ docker ps

CONTAINER ID        IMAGE                               COMMAND                  CREATED             STATUS              PORTS                                                                         NAMES
3032464e8fd9        magento/magento2devbox-web:latest   "/usr/local/bin/en..."   About an hour ago   Up 54 minutes       5000/tcp, 9000/tcp, 44100/tcp, 0.0.0.0:32770->22/tcp, 0.0.0.0:32769->80/tcp   magento2devbox_web_7299181703f96e251f8ade2bbb8a1763
835e5e466881        mysql:5.6                           "docker-entrypoint..."   About an hour ago   Up 54 minutes       0.0.0.0:32768->3306/tcp                                                       magento2devbox_db_7299181703f96e251f8ade2bbb8a1763

Under the mysql:5.6 image, you see 0.0.0.0:32768->3306/tcp.

This means that you can use a MySQL client like Sequel Pro or MySQL Workbench to connect:

Host: 127.0.0.1

Username: root 

Password: root

Port: 32768

I'm not sure if the port is constant.

But you can always check with docker ps. In the guide you linked, it looks like there are instructions to set up a static port so that connecting with PHPStorm is less burdensome. I assume this process generalizes to the MySQL container.

The default username:password is root:root.

You can confirm this:

[local]$ docker exec --user=magento2 -it magento2devbox_web_12345678 /bin/bash
[magento2]$ cd magento2
[magento2]$ cat app/etc/env.php

Inside you will see the database connection credentials.

  • appears to work fine in Sequel Pro, thanks – mike-source Mar 1 '17 at 12:22
  • by the way... by default the database name is "magento2" and that's the only other credential required – mike-source Mar 1 '17 at 12:23
1

You can also go in directly to the container's mysql command line like so:

docker-compose exec db mysql -u root -p

(when prompted, the passwored is root)

This assumes the default DevBox settings with the mysql container called db and the username and password both as root.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.