Database access using docker

I installed a new wordpress project using docker’s guide:

mkdir my-wordpress-site
cd my-wordpress-site
ddev config --project-type=php
ddev composer create wordpress/skeleton --no-interaction --prefer-dist
ddev config --docroot=wp --project-type=wordpress
ddev restart

All done and I ran the front-end configuration.

I am used to running things in windows(xampp) and heard of MAMP for mac. but now I need to use docker and have no clue of how to go about things.

Question is: Is there a way I can access my database using Docker? ssh or anything?

2 Answers
2

There are ever-so-many ways to access the database. ddev describe will open your eyes to them.

  • As @Andy Mardell points out, you can use the built-in PHPMyAdmin (link in ddev describe)
  • You can also use a mysql client on the host, the port and such for this are also shown in ddev describe
  • You can also use ddev mysql for direct access to the database (ddev v1.10+)
  • On macOS, you can use ddev sequelpro if you have the excellent, free SequelPro installed.
  • You can also ssh into either the web container or the db container, ddev ssh or ddev ssh -s db and use the mysql client there.
  • You can also use ddev exec mysql, which is really pretty much the same as ddev mysql

I hope that’s enough ways! 🙂

Leave a Comment