Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Homestead to work with MySQL Workbench

I just started using Homestead today and so far I don't think I know what I am doing, previously I was using the inbuilt PHP server that comes with Laravel and I had MySQL server and workbench installed separately on my computer.

With this setup I was able to connect to my database with ease, however since I got my Homestead running I can't seem to access that database again. This error keeps popping up:

3/3 ErrorException in Connector.php line 47: SQLSTATE[HY000] [1045] 
Access denied for user 'myproject_db101'@'localhost' (using password: YES) 
(View: /home/vagrant/Projects/myproject/resources/views/layout/index.blade.php) 
(View: /home/vagrant/Projects/myproject/resources/views/layout/index.blade.php) 

How can I fix this?

like image 517
user3718908x100 Avatar asked Apr 16 '15 15:04

user3718908x100


2 Answers

I was facing the same issue and I tried below steps to fix it. Please let me know if they work for you.

  1. Note the homestead ip address for your vagrant box. It is available in Homestead.yaml file under ~/.homestead directory. This directory location would be different on different OS. But since you have already installed vagrant with homestead you should know its location. For me the ip address was 192.168.10.10.
  2. Open up the Mysql Connection wizard and provide the below settings hostname = 192.168.10.10 port = 3306 username = homestead password = secret
  3. Test Your connection

For me these settings worked. Check if they work for you.

like image 62
Prakhar Avatar answered Sep 24 '22 23:09

Prakhar


These other answers might have worked for you guys, but in case anyone has a case like mine, I'm just going to provide what worked for me. Hopefully it helps someone out. I'm working on a brand new homestead installation as of today, but on a very old mac in case thats relevant.

What worked for me was using the regular localhost ip of my machine as the host, and then the homested/secret combination for the password, and using the default port but with a 0 at the end. This adds up to be the following settings:

Connection method: Standard (TCP/IP)

Host: 127.0.0.1
Username: homestead
Password: secret
Port: 33060

Hopefully this helps someone out. Its the only configuration that worked for me.

like image 24
Benjamin Bjørn Nielsen Avatar answered Sep 24 '22 23:09

Benjamin Bjørn Nielsen