MySQL Workbench And Homestead

in Laravel

If you do Laravel development then you most likely are using Homestead for your local development environment, if you're not using Homestead then I can't recommend it enough to get you started.

Homestead is a package you can install with your Laravel project which will create a virtual machine using Vagrant you can use for your development environment. This means you can have a web server up and running in seconds without having to install PHP and Nginx/Apache on your computer.

If you want to learn more about Vagrant and Homestead please visit the following tutorials

Before I used Vagrant for my development I would install everything locally, this includes a Database interface such as PhpMyAdmin, then I switched to use MySQL Workbench. In this tutorial, we're going to learn how to use MySQL Workbench with Homestead.

Homestead Hostname

First, you need to get the Homestead IP address, you can see this from your Homestead config file Homestead.yaml

ip: "192.168.10.10"
memory: 4000
cpus: 1
provider: virtualbox

At the top of the Homestead.yaml file you'll see the above, as you can see our Homestead IP address is 192.168.10.10, we'll need to use this with MySQL Workbench to connect to your Homestead box via SSH.

MySQL Workbench Connection

Create a new connection within MySQL Workbench and select the connection method to be Standard TCP/IP Over SSH.

Enter the SSH Hostname as your IP address 192.168.10.10.

The SSH Username is vagrant.

The SSH Password is vagrant.

The MySQL Hostname is 127.0.0.1 which is the localhost from the Homestead box.

The MySQL Post number we're using is going to be 3306.

The MySQL Username is homestead.

And finally, the MySQL Password is secret.

Now, test your connection and you should be able to view the database successfully.

Upgrade to access all content on Paulund

Members unlock all tutorials and snippets

Access to all downloadable content

Access to code examples before others

Sign Up Now

Already a member? Login here

Subscribe To Newsletter

Get weekly updates to your email