1

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:

  1. download and install composer, vagrant and virtualbox
  2. create laravel/laravel project with composer (create composer project in phpstorm)
  3. integrate laravel/homestead with composer: composer require laravel/homestead --dev
  4. build homestead in root dir: vendor\\bin\\homestead make (windows)
  5. personalize my local domain by setting it in Homestead.yaml -> sites -> map: mydomain.com
  6. integrated the domain in c:/windows/system32/drivers/etc/hosts: 192.168.10.10 mydomain.com
  7. create empty ssh key for vagrant to run: fsutil file createnew C:/Users/<username>/.ssh/id_rsa 0
  8. start VM with vagrant: vagrant up

So far so good, everything seems to work. And here comes the problem:

  1. create mysql database with phpstorm'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?

2
  • 1
    Are you really trying to talk to a MySQL server that doesn't exist?! Commented Aug 18, 2021 at 0:52
  • It does look like it. Thanks 🙂 Commented Aug 18, 2021 at 8:39

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.