admin管理员组文章数量:1416083
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?
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?
Share Improve this question edited Aug 13, 2019 at 22:29 rkoller 6343 gold badges14 silver badges26 bronze badges asked Aug 13, 2019 at 14:03 Sidney SousaSidney Sousa 2134 silver badges14 bronze badges2 Answers
Reset to default 5There 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
orddev ssh -s db
and use the mysql client there. - You can also use
ddev exec mysql
, which is really pretty much the same asddev mysql
I hope that's enough ways! :)
PhpMyAdmin
phpMyAdmin is installed with the commands you ran.
It seems to generate a random port. So do the following:
docker ps
You should see a line which is called drud/phpmyadmin
. Look along the table and you should see the port it's running on. In my case, this was 0.0.0.0:32773->80/tcp
So if I go to http://localhost:32773 I see phpmyadmin, where you can access and edit your database.
PhpMyAdmin is fine to start, but you might want to use a database client to remotely access the database long term:
Remote access
If you want to use a database client to connect to your database, there is a similar process. Find out what port your database image is exposing:
ps docker
See the line called drud/ddev-dbserver
? What port is this using? In my case it was 127.0.0.1:32782->3306/tcp
.
So to connect to this database I can use port 32782. Again, in my case the details to connect were:
Host: 127.0.0.1 Database: db User: db Password: db Port: 32782
Hope that helps
本文标签: Database access using docker
版权声明:本文标题:Database access using docker 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745245255a2649526.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论