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

Add a "ddev mysql" command #1551

Closed
dmitryd opened this issue Apr 29, 2019 · 11 comments
Closed

Add a "ddev mysql" command #1551

dmitryd opened this issue Apr 29, 2019 · 11 comments
Labels
Prioritized We expect to do this in an upcoming release

Comments

@dmitryd
Copy link

dmitryd commented Apr 29, 2019

While ddev exec --service db mysql is documented, it would be much easier & faster to type ddev db for this. Could you implement it, please?

Thanks!

@rfay
Copy link
Member

rfay commented Apr 29, 2019

Could you say more about what you use the mysql command for? It sounds like you must do it a lot.

Note that there are so many ways to access the database:

  • Use it on the host (ddev describe shows how)
  • Use it in the web container (ddev exec mysql)
  • Use phpmyadmin (see ddev describe)
  • Use ddev sequelpro (macOS only)
  • (I personally use ddev ssh and just use mysql in the web container)

@mglaman
Copy link
Contributor

mglaman commented May 1, 2019

I find myself having to

ddev ssh
../vendor/bin/drush sqlc

or I use ddev describe to put the port in DataGrip. I would like to see a ddev db shortcut. Platform.sh has platform sql as their shortcut to launch into the database CLI.

@rfay
Copy link
Member

rfay commented May 1, 2019

I don't object... but
FYI,

  • drush sql-cli works fine on the host if you have drush8 on the host.
  • You don't have to use vendor/bin because the drush launcher shipped in the container works fine
  • Since v1.7.1 it's possible to force the port that the db container binds to, so it's easy to use other tools.

And come to think of it, I don't know why we never provided a direct mysql command, since it's right there in ddev describe

Just making noise about options.

I guess I didn't really understand the OP. What's being asked for is a simple command like ddev sequelpro that uses mysql in a one-shot I guess.

@rfay
Copy link
Member

rfay commented May 1, 2019

Interested in what the votes would be for the name of a command. ddev mysql ?

@dmitryd
Copy link
Author

dmitryd commented May 5, 2019

@rfay I am an advanced sql user and I prefer console. Launching Sequel Pro or typying a long command (ddev exec .......) for something as trivial as launching a mysql console for making several analytical queries is an overkil. The purpose of every environment (including ddev) is to simplify the life for people and make them focus on their real tasks. Thus adding a ddev db would give access database to those, who prefer a low level, direct sql database access.

@rfay
Copy link
Member

rfay commented May 6, 2019

Thanks for helping me understand @dmitryd -

The reality is we're long overdue for allowing a tty and interactive behavior on ddev exec. I wonder if just ddev exec mysql with interactive behavior would do the job for most of us.

(I use mysql as you do, almost never use another tool. My habit is to ddev ssh and then use it (from the web container). We certainly should have easier ways though.

@rfay rfay added the Prioritized We expect to do this in an upcoming release label May 6, 2019
@rfay rfay changed the title Add a "ddev db" command Add a "ddev mysql" command May 6, 2019
@rfay
Copy link
Member

rfay commented May 6, 2019

Just FYI #1571 allows easy ddev exec mysql and things like ddev exec vi index.php

@mglaman
Copy link
Contributor

mglaman commented May 6, 2019

I would be happy with ddev exec mysql; because I have tried ddev exec drush sqlc as a short cut as well.

@rfay
Copy link
Member

rfay commented May 6, 2019

#1571 also makes ddev exec sqlc work fine, along with other drush commands that want interaction.

@rfay rfay added this to the v1.10 milestone Jun 28, 2019
@selwynpolit
Copy link

selwynpolit commented Jul 3, 2019

Perhaps using a drush alias would make this easier. Something like drush @d8git.dev sqlc would be consistent with drush usage elsewhere. I often use drush aliases to issue commands to Drupal on remote servers.

It seems that it shouldn't be too difficult to set up a drush alias for a drupal 8 site. I'm hitting some snags tho. It looks like the command to ssh into a docker container is something like:
docker exec -it b20ef7e7d141 bash
I need something more along the lines of ssh user@server
Any suggestions?

@rfay
Copy link
Member

rfay commented Jul 4, 2019

You'll want to use ddev exec I would think. Note that drush also works on the host for many commands. But there's no ssh server inside the web container, so you can't use real ssh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prioritized We expect to do this in an upcoming release
Projects
None yet
Development

No branches or pull requests

4 participants