Sequel Pro closes Laravel Homestead SSH session - php

Ever since upgrading to the newest version of Laravel Homestead (v0.4.0), I'm having a weird issue where when I try to log in to Sequel Pro, it disconnects my Homestead SSH and does not let me back in unless I do vagrant suspend followed by vagrant up.
The error message it gives me is:
vagrant#homestead:~$ Connection to 127.0.0.1 closed by remote host.
Connection to 127.0.0.1 closed.
And when I then try and login via Sequel Pro I get the following error message:
Connection Failed!
Unable to connect to host 127.0.0.1, or the request timed out.
Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).
MySQL said: Can't connect to MySQL server on '127.0.0.1' (61)
My Sequel Pro settings are:
Name: Homestead
Host: 127.0.0.1
Username: homestead
Password: secret
Port: 33060
Worth referencing I have setup Sequel Pro as per this post here: http://www.tannerhearne.com/using-sequel-pro-laravel-homestead/

I actually solved this by using the following Sequel Pro settings:
Host: 192.168.10.10
Username: Homestead
Password: secret
Port: 3306
where 192.168.10.10 is the IP address of my vagrant box.
It seems the new Homestead update (v0.4.0) rendered my previous settings, useless.

Related

MySQL8 connection with php7.3 and Symfony 5 does not work

I have a connection problem with a mysql8 database, php7.3 and Symfony 5. The user and the password are correct !
The connection to MySQL8 database must be done from an SSH tunnel
The SSH tunnel is working :
ssh -p [remote_machine_port] -N -L [mysql_tunnel_port]: 127.0.0.1: 3306 -i / [directory] / private_key [username] # [remote_machine_ip]
MySQL access configuration:
GRANT ALL PRIVILEGES ON 'databasename'.* TO '[user]'#'%' WITH GRANT OPTION;
Doctrine configuration :
DATABASE_URL='mysql://[user]:[password]#127.0.0.1:[port_tunnel_mysql]/[databasename]'
An exception occurred in driver: SQLSTATE [HY000] [1130] Host '127.0.0.1' is not allowed to connect to this MySQL server
I have the same problem with heidiSQL and on the VM
I tried with the Ip of the VM instead of 127.0.0.1
ssh -p [port_machine_distant] -N -L [port_tunnel_mysql]:[ip_machine_vm]:3306 -i /[directory]/private_key [username]#[ip_machine_distant]
Doctrine configuration
DATABASE_URL='mysql://[user]:[password]#[ip_machine_vm]:[port_tunnel_mysql]/[databasename]'
An exception occurred in driver: SQLSTATE [HY000] [2002] Connection refused
However, this setting works with heidiSQL but not with the Symfony application !
Did I forget a setting on the VM or Mysql ?
127.0.0.1 connection issue :
We have created the '[user]'#'127.0.0.1' rights.
In MySQL, 127.0.0.1 uses the network and localhost uses the socket.
The message "The server requested authentication method unknown to the client [caching_sha2_password]" was caused because the setting 'default-authentication-plugin=mysql_native_password' was created after the creation of the rights.
We regenerated the rights, and now everything is working fine.

Connecting to MySQL from Laravel vagrant box

I am using Sequel Pro on Mac and trying to see my database schemas that Laravel created. In the migrations folder I see a users and password reset tables. I am trying to see them in sequel pro which I do not.
I used homestead and the vagrant box is up. The homestead.yaml is set to defaults to:
IP: 192.168.10.10
MySQL db: homestead
In the .env file I see the defaults too:
IP: 127.0.0.1
MySQL: homestead
User: homestead
Password: secret
I try to use both IP's but can't seem to connect and if I do connect with 192.168.10.10 I see 0 tables. What am I missing? New to Vagrant and Laravel too.
You should try to declare the DB connection to
config/databases.php
note that you can declare multiple DB connections here if you don't use .env for course.
then try php artisan cache:clear

ERROR 2003 (HY000) while trying to connect to mysql remotely

I am trying to connect to mysql remotely. Because this is such a common question I read several tutorials/questions but I keep getting this error:
ERROR 2003 (HY000): Can't connect to MySQL server on 'the-ip-address' (60)
I edited the /etc/mysql/my.cnf and commented the line of bind_address like this:
#bind-address = 127.0.0.1
After that I ran:
$ sudo service mysql restart
with the output of:
mysql stop/waiting
mysql start/running, process 9853
mysql is running on default port: 3306
Using the user with which I am trying to connect remotely is working locally on the server (I can connect to the mysql from the server).
In phpmyadmin I configure these users:
user#localhost
user#127.0.0.1
user#87.45.34.23
Then I am trying to connect with the following:
mysql -u user -p -h 87.45.34.23
Maybe I am missing something... Thank you in advanced
UPDATE
As #Geoffrey suggested in the comments the problem was with a firewall. For this reason I will accept his answer although the answer itself is not for that but in the comments he was right.
Connection refused means the MySQL server is not listening or is firewalled.
By commenting out the bind line, MySQL doesn't bind to anything and only allows local socket access, you need to bind it to either the local IP, or all IPs by specifying 0.0.0.0
Also ensure that skip-networking is not set anywhere.

Php - phinx migration

I am using phinx for migrations in my web app.
my phinx.yml:
paths:
migrations: %%PHINX_CONFIG_DIR%%/migrations
environments:
default_migration_table: app_migrations
default_database: app_database
development:
adapter: mysql
host: localhost:8888
name: app_database
user: ''
pass: ''
port:8889
I have mamp with ports apache:8888 and mysql:8889 running.
The database app_database does exist.
The table app_migrations does not exist(it will be created while migrating right?)
I already created some migrations and now i try to run them:
php vendor/bin/phinx migrate -e development
output in console:
Phinx by Rob Morgan - https://phinx.org. version 0.5.1
using config file ./phinx.yml
using config parser yaml
using migration path /path/to/directory/migrations
using environment development
using adapter mysql
using database app_database
Then it stops and nothing happens...
Anybody could help me with this issue?
Thanskj and Greetings!
Maybe there is some config-hickup. I know this phenomenon from conneting to a mysql-database that is not reachable via a specific host / port. This always leads to timeouts but only after eg. 60 seconds.
You wrote this in your config:
host: localhost:8888
[...]
port: 8889
First remove the port from the hostname:
host: localhost
port: 8889
and as second verify the mysql-server is really listening on localhost / port 8889.
You'll find more on in the "Configuration"-chapter of phinx-documentation: http://docs.phinx.org/en/latest/configuration.html
Regards
If you're using the default settings for MAMP, the username for the database would be root. Try changing the value of user in phinx.yml to root.

Accessing mysql dbase with MysqlWorkBench on VirtualBox (Vagrant - ZF - BoilerPLate)

Does anyone know hot to connect to VB MySQL via MysqlWorkBench. I can log in in virtual box via terminal, but I can not connect it throught MySqlWorkBench. Also I can ping google on vb, ifconfig gave me 10.0.2.15 address, and when I enter it in MysqlWorkBench I got error:
Failed to Connect to MySQL at 127.0.0.1:3306 through SSH tunnel at 10.0.2.15:2222 with user davs
My Virtual box use port 2222 for connecting. Also when I try to connect with ip 127.0.0.1
Failed to Connect to MySQL at 127.0.0.1:3306 through SSH tunnel at 127.0.0.1:2222 with user davs Failed to Connect to MySQL at 127.0.0.1:3306 through SSH tunnel at 127.0.0.1:2222 with user davs
Any advice will be helpfull, thanks.
This looks like an old question but since I just ran into the problem, here are the settings that I used on MysqlWorkbench to get everything working on my mac:
Connection Method: Standard TCP/IP over SSH
SSH Hostname: 127.0.0.1:2222
SSH Key File: /Users//.vagrant.d/insecure_private_key
Mysql Hostname: 127.0.0.1
Mysql Server Port: 3306
Username: root
Password: vagrant
Your settings may be slightly different but the key part is using the insecure private key as was mentioned earlier.
Use the 'insecure private key' located at: ~/.vagrant.d/insecure_private_key

Categories