I can not create a connection to a MySQL database in a vagrant machine with PhpStorm.
My settings are:
DATABASE tab:
- Host: 127.0.0.1
- Port: 3306
- User: root
- Password: root_passsword
SSH/SSL tab:
- Proxy host: 192.168.56.102
- Port: 22
- Proxy user: vagrant
- Proxy password: vagrant
Can someone help me? Thanks
In SSH/SSL tab, select Auth type Key pair
, then copy the path to private key file define in IdentityFile
. For instance C:/virtualM/deb56/puphpet/files/dot/ssh/id_rsa
$vagrant up $vagrant ssh-config Host local HostName 127.0.0.1 User vagrant Port 2222 UserKnownHostsFile /dev/null StrictHostKeyChecking no PasswordAuthentication no IdentityFile "C:/virtualM/deb56/puphpet/files/dot/ssh/id_rsa" IdentityFile "C:/Users/User/.vagrant.d/insecure_private_key" IdentitiesOnly yes LogLevel FATAL
Here is a really nice article on this subject:
https://www.theodo.fr/blog/2017/03/how-to-manipulate-the-mysql-database-of-your-vagrant-from-phpstorm/
That is:
cd ~/path/to/your/project
vagrant ssh-config
command from the terminalOr just visit the page which URL I posted at top.
If you're using Homestead, these settings worked just fine for my Vagrant box:
Host: 192.168.10.10
Port: 3306
Username: homestead
Password: secret
Then again, so did MilanG's answer, so pick whatever you feel comfortable with. Since it's just local for me I did this and then I won't have to update my keyfile path should I move my Vagrant box. But that's really minor so do whatever you feel is best.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With