Laravel Homestead Cannot Connect to MySQL from host - mysql

I saw many threads on forums and Stackoverflow about this issue but none were addressing in a way that worked for me.
I used the following credential on my host computer (using Sequel Pro) to log in homestead MySQL as documented:
host: 127.0.0.1
username: homestead
password: secret
It says that "Unable to connect to host 127.0.0.1, or the request timed out".
I then tried to log using ssh:
MySQL host: 10.0.2.15
Username: homestead
Password: secret
Port: 3306
SSH host: 192.168.10.10
SSH user: vagrant
SSH Password: ~/.ssh/id_rsa
I got "Connection failed: Your password has expired. To log in you must change it using a client that supports expired passwords."

I then followed this to change my password.
homestead ssh
mysql -uhomestead -psecret
SET PASSWORD = PASSWORD('secret');
That fixed my problem as I was now able to connect from ssh as described above.

Related

DataGrip MySql connection timeout - tableplus+cli both work instantly

I am attempting to connect to a MySql DB with DataGrip, but it just endlessly fails due to timeouts.
I have successfully connected near-instantly with both TablePlus and by manually sshing in and using mysql in the cli.
The access arrangement is between my laptop: computer A, a gateway machine: computer B, and the database machine: computer C, in the structure:
A-->B-->C
My credentials are all present and correct and have been checked and reentered, and are as such:
GENERAL
Host: localhost
Port: 3306
User: <username>
Password: <password>
Save: Forever
Database: <database name>
SSH/SSL
Proxy host: C<.url.tld>
Proxy port: 22
Proxy user: <username>
Local port: 3306
Auth type: Key pair (OpenSSH or PuTTY)
Private key file: <path to ssh key>
Passphrase: <password>
Remember: Forever
Also, my ssh config:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Host B<.url.tld>
ForwardAgent yes
User <username>
Host *<url.tld> !B<url.tld>
ProxyJump B<.url.tld>
User <username>
ForwardAgent yes
The logs simply record
com.intellij.execution.ExecutionException: SSH: Error connecting to remote host C<.url.tld>: Operation timed out (Connection timed out)
with a nice lengthly Java stacktrace of the exact same error over and over again all the way down.
I have tried varying the details in the setup many times and repeatedly got the same error - the only difference is if I deliberately enter my ssh key passphrase incorrectly, it requests it be reentered correctly.
What is going on? How do I fix this and connect to the DB?

unable to access mysql database with no password to git

I am trying to access github database from the terminal and I am getting this error. Any suggestions? Below is the link for accessing the database.
http://ghtorrent.org/mysql.html
ssh -L 3306:web.ghtorrent.org:3306 ghtorrent#web.ghtorrent.org
Enter passphrase for key '/Users/abc/.ssh/id_rsa':
bind: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 3306
Could not request local forwarding.
PTY allocation request failed on channel 0
on the other terminal 2
mysql -u ght -h 127.0.0.1 ghtorrent
ERROR 1045 (28000): Access denied for user 'ght'#'localhost' (using password: NO)
Something (probably a local mysqld) on your local system is already listening on port 3306, so your port forward is not working, as ssh tries to explain in this series of error messages:
bind: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 3306
Use a different local port, and specify that port in your mysql client invocation. For example, to use port 33306:
ssh -L 33306:web.ghtorrent.org:3306 ghtorrent#web.ghtorrent.org
and
mysql -u ght -h 127.0.0.1 -P 33306 ghtorrent

How to connect to vagrant mysql database with Sequel Pro

How do I connect to vagrant mysql database with Sequel Pro? Specifically, ScotchBox 3?
An easy option is to connect via Sequel Pro's SSH option:
MySQL Host: 192.168.33.10 (or your vagrant IP address, if different)
Username: root (or your custom mysql username)
Password: root (or your custom mysql password)
SSH Host: 192.168.33.10 (or your vagrant IP address, if different)
SSH User: vagrant
SSH Password: vagrant

vagrant sequel pro SSH Tunnel remote host can't connect, bad password

I'm new to MySQL and Vagrant and spent several hours trying to set both up. I can connect to MySQL from the command line with:
mysql --host=127.0.0.1 --user=root --password=[my_password]
I'm trying to connect with Sequel Pro and following a couple tutorials have set up Vagrant/MySQL correctly, I believe. I'm trying to connect thru SSH and tried many combinations of username/password. I believe the correct inputs are:
MySQL Host: 127.0.0.1
username: root
password: [my_password]
SSH Host: 127.0.0.1
SSH User: vagrant
SSH Key: insecure_private_key
SSH Port: 2222
however I'm still getting the error "The SSH Tunnel could not authenticate with the remote host. Please check your password and ensure you still have access."
Any help is appreciated, thanks
You need to choose SSH connection type and select the correct private key.
For Vagrant 1.6 and older, the private key is located in ~/.vagrant.d/insecure_private_key. For Vagrant 1.7 and above, the private key is located in .vagrant/machines/[vm_name]/virtualbox/private_key where the Vagrantfile is located.
Try the following configuration and leave everything else blank. (Of course specify MySQL root password if you've set it up.)
MySQL Host: 127.0.0.1
Username: root
Port: 3306
SSH Host: 127.0.0.1
SSH User: vagrant
SSH Key: ~/.vagrant.d/insecure_private_key
SSH Port: 2222
I got the same error and this solved the issue for me.
ssh-add -K ~/.ssh/id_rsa
For me work added my key identity
ssh-add -K ~/.ssh/id_rsa

Vagrant: open mysql connection to host

I'd like to use MySql Workbench to browse my database in Vagrant from host machine.
So far I just commented the line bind-address = 127.0.0.1 in my.cnf and all was ok, but recently I connected to a new wi-fi and things seemed to change, I had to change guest ip address from 192.168.0.200 to 192.168.1.200 and I can't open mysql connection from host.
I tryed also to add bind-address = 10.0.2.2 guessing (not sure) this was my host ip but still the same.
What do I need to do?
Thank you
Define a static ip for your box like in this example:
Vagrant.configure("2") do |config|
config.vm.network "private_network", ip: "10.0.0.6"
In Mysql Workbench create a new connection over SSH:
Connection Method: Standard TCP/IP over SSH
SSH Hostname: 10.0.0.6 (like above)
SSH Username: vagrant
SSH password: vagrant
MySQL Hostname: 127.0.0.1
MySQL Username: root
MySQL Password: root
SSH Host Key identification:
Instead of a password you can use the box specific Private Key. You can get the path by executing vagrant ssh-config.