Search code examples
laravelsshvagranthomesteadheidisql

Vagrant / laravel/homestead / HeidiSQL casual problems


LM:

Vagrant 1.8.1
Laravel Homestead version 3.0.1

Problems:

  1. [PDOException] SQLSTATE[HY000] [2002] Can't connect to ...
  2. [PDOException] SQLSTATE[HY000] [2002] No connection could ... refused it.
  3. Refuse to connect to DB via Heidi

I've browsed many discussions and found some solutions for you. Feel free to post similar problems.


Solution

    • Make sure what PHP are you using and check php.ini for extension=php_pdo_mysql.dll
    • Check your homestead.rb and set ports for guest and host, same as in the my.cnf accesed by sudo nano /etc/mysql/my.cnf inside the box!
    • Check your database.php (mine) leave default, you can add
      'port' => env('DB_PORT', 33060), You need to change only .env file in your root project (mine)
    • There was also problems with need to change localhost/127.0.0.1 depending on the route.
    • Run vagrant reload & vagrant provisions
    • My Heidi setup [sql][3] [ssh][4] (links in comment → no rep)

    I hope that this will help somebody, because I was quite mad!