eko / docker-symfony

Run a Symfony application using Docker & docker-compose

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection refused

truckee opened this issue · comments

I've installed eko/docker-symfony in WSL2/Ubuntu-20, along with a working Symfony project in dev mode. On launching http://symfony.localhost/ I get a MySQL

An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused

The exception is thrown in an entity's repository:

        $fileNames = $this->createQueryBuilder('f')
                ->select('f')
                ->orderBy('f.filename', 'DESC')
                ->getQuery()
                ->getArrayResult()
        ;

Edit: (logs available after docker-compose down & docker-compose up).

Stuck dd($params) in Doctrine\DBAL\Driver\PDOMySql\AbstractMySQLDriver and got this:

Driver.php on line 22:
array:11 [▼
  "url" => "mysql://symfony:symfony@127.0.0.1:3306/rv?serverVersion=8.0"
  "host" => "127.0.0.1"
  "port" => 3306
  "user" => "symfony"
  "password" => "symfony"
  "driver" => "pdo_mysql"
  "driverOptions" => []
  "defaultTableOptions" => array:1 [▶]
  "dbname" => "rv"
  "serverVersion" => "8.0"
  "charset" => "utf8mb4"
]

From logs/nginx:

172.25.0.1 - - [28/Dec/2020:14:38:06 +0000] "GET / HTTP/1.1" 500 479223 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"
172.25.0.1 - - [28/Dec/2020:14:38:10 +0000] "GET /_wdt/6fa7eb HTTP/1.1" 200 4339 "http://symfony.localhost/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0"

After installing MySQL client in WSL/Ubuntu:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

In PowerShell:

ERROR 1045 (28000): Access denied for user 'symfony'@'172.27.0.1' (using password: YES)

Edit:
docker-compose exec db mysql -u root -p allows connection.

Should have found issue at #83.