0

Using Laravel 8

Ubuntu 20.04 with Docker

Connect to Database over clients worked perfect. Docker-Container worked.

If I dont start it with php artisan serve it refused the connection to mysql.

With php artisan serve it connects to mysql-docker-container.

I want deploy it. But if I make it like this doc: https://laravel.com/docs/8.x/deployment it worked fine, but only DB-connection crashes.

I tried: SQLSTATE[HY000] [2002] Connection refused within Laravel homestead

But if I change the Host it answer with this mistake: PDOException: SQLSTATE[HY000] [2002] No such file or directory

need help.

JayDee
  • 61
  • 1
  • 6
  • So `php artisan serve` connects to the database when you run it in the docker container? – apokryfos Feb 11 '22 at 11:21
  • in docker-container it would start too. I tested it know. But I dont start ```php artisan serve``` in docker. For what I need docker if I start it into docker ? I use it with docker to test deploying – JayDee Feb 11 '22 at 11:24
  • So in general you can't connect to the database from within the docker container? – apokryfos Feb 11 '22 at 16:21

1 Answers1

0

dont forget... WSL :)

use mysql not localhost.

JayDee
  • 61
  • 1
  • 6