Thursday, December 10, 2020

Accessing homestead database from outside of the environment

Accessing homestead database from outside of the environment

🔥 Save unlimited web pages along with a full PDF snapshot of each page.
Unlock Premium →

Unhandled Perfection

When you boot up your homestead environment you should see the following logs.

WARNING: For more information: https://www.vagrantup.com/docs/vmware/boxes.html#vmx-whitelisting
==> homestead-7: Starting the VMware VM...
==> homestead-7: Waiting for the VM to receive an address...
==> homestead-7: Forwarding ports...
homestead-7: -- 80 => 8000
homestead-7: -- 443 => 44300
homestead-7: -- 3306 => 33060
homestead-7: -- 4040 => 4040
homestead-7: -- 5432 => 54320
homestead-7: -- 8025 => 8025
homestead-7: -- 27017 => 27017
homestead-7: -- 22 => 2222

This makes the mysql port (3306) accessible from the outside environment using port (33060). This means you should technically be able to connect from the outside using port 33060 and using your local machine 127.0.0.1 as a host. This in fact use to work quite well however today on a fresh install and using Homestead 7 it didn't seem to go through like before.

An alternate and more direct way to connect from the outside is to use the IP of your homestead environment.

Step 1) Find the IP of your homestead environment

Unless you've changed it. It should be 192.168.10.10 by default but just to double check open up your Homestead.yaml.

Step 2) Connect to your database

Here I'm using SQLYog to perform the connection using the following information

MySQL Host Address: 192.168.10.10
Username: homestead
Password: secret
Port: 3306

Done.

Source: https://medium.com/unhandled-code/connect-to-your-homestead-database-from-the-outside-cf52667a11fe
This web page was saved on Wednesday, Dec 09 2020.

Upgrade to Premium Plan

✔ Save unlimited bookmarks.

✔ Get a complete PDF copy of each web page

✔ Save PDFs, DOCX files, images and Excel sheets as email attachments.

✔ Get priority support and access to latest features.

Upgrade now →

No comments: