SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

前端 未结 16 769
说谎
说谎 2021-01-03 17:56

I download from https://github.com/luciddreamz/laravel Laravel for openshift then upload over my repository over github. This code for connect to database not work. The prob

16条回答
  •  长发绾君心
    2021-01-03 18:24

    If someone facing this problem when using Docker, be sure if you are using your version of SQL.

    In my case: MYSQL_VERSION=latest changing to MYSQL_VERSION=5.7.

    Then you need to remove your unused Docker images with docker system prune -a (docs).

    Also, in your .env you need to change DB_HOST=mysql. And run php artisan config:clear.

    I think it will help someone.

提交回复
热议问题