I am trying to pass a simple command to a vagrant machine.
vagrant ssh -c "mysql -u root -e'CREATE DATABASE testing';"
db is not created. Instead, I just βlogged inβ to the vagrant machine via ssh.
The same thing happens when I run
vagrant ssh -c "touch test.txt"
I also tried:
- single quotes around the command
--command
instead of the abbreviated -c
Any ideas what is going on?
Edit
I am going to distribute my script and it is going to integrate my script with Homestead, so it cannot really configure the configuration of the vagrants.
Edit
Since I use Homestead, the user and pw are different. It should be
vagrant ssh -c "mysql -u homestead -psecret -e'CREATE DATABASE testing;'"
without changing the code above to avoid confusion with the answers already submitted.
Nevertheless, this does not solve the problem. The same thing happens as described above.
source share