I am trying to set up a laravel
project in phpstorm
but fail at connecting to a mysql
database. These are the steps I've taken so far:
- download and install
composer
,vagrant
andvirtualbox
- create
laravel/laravel
project withcomposer
(createcomposer
project inphpstorm
) - integrate
laravel/homestead
withcomposer
:composer require laravel/homestead --dev
- build homestead in
root dir
:vendor\\bin\\homestead make
(windows) - personalize my local domain by setting it in
Homestead.yaml -> sites -> map
:mydomain.com
- integrated the domain in
c:/windows/system32/drivers/etc/hosts
:192.168.10.10 mydomain.com
- create empty
ssh key
forvagrant
to run:fsutil file createnew C:/Users/<username>/.ssh/id_rsa 0
- start
VM
withvagrant
:vagrant up
So far so good, everything seems to work. And here comes the problem:
- create
mysql
database withphpstorm's
integrated database tool, using.env
as reference (DB_CONNECTION=mysql
,DB_HOST=127.0.0.1
,DB_PORT=3306
,DB_DATABASE=laravel
,DB_USERNAME=root
,DB_PASSWORD=devpw
)
After installing drivers
when trying to test connect:
[08S01]
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Or in the log:
java.net.ConnectException: Connection refused: connect.
I've been trying to find a fix for some time now without success. This Thread seems to provide solutions, many of which I am not sure how to implement, since they are not directed at phpstorm
. I feel a bit overwhelmed by the whole backend
thing and how to set it up right in laravel
.
Am I supposed to install mysql
on windows before integrating it into phpstorm
?