Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illuminate\Database\QueryException could not find driver (SQL:) #320

Closed
raimondas-nuz opened this issue Jan 24, 2022 · 3 comments
Closed

Comments

@raimondas-nuz
Copy link

raimondas-nuz commented Jan 24, 2022

  • Sail Version: 1.12.10
  • Laravel Version: 8.75.0
  • PHP Version: 8.1.2
  • OS: Ubuntu 20.04.3 LTS
  • Docker version: 20.10.12
  • docker-compose version: 1.27.4

Description:

I'm trying to build laravel app using sail build --no-cache command. But when it is finished I see php version is 8.1.2, but in the docker-compose.yml I have:
context: ./vendor/laravel/sail/runtimes/**8.0**
image: sail-**8.0**/app.
And when I'm trying to login into my app, I'm getting Illuminate\Database\QueryException could not find driver (SQL:) error.

I'm also getting the same error in the sail artisan tinker

Steps To Reproduce:

docker-compose.yml

# For more information: https://laravel.com/docs/sail
version: '3'
services:
    myapp.localhost:
        build:
            context: ./vendor/laravel/sail/runtimes/8.0
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.0/app
        extra_hosts:
            - 'host.docker.internal:host-gateway'
        ports:
            - '${APP_PORT:-80}:80'
        environment:
            WWWUSER: '${WWWUSER}'
            LARAVEL_SAIL: 1
            XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
            XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
        volumes:
            - '.:/var/www/html'
        networks:
            - sail
        depends_on:
            - mysql
            - redis
    mysql:
        image: 'mysql/mysql-server:8.0'
        ports:
            - '${FORWARD_DB_PORT:-3306}:3306'
        environment:
            MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ROOT_HOST: "%"
            MYSQL_DATABASE: '${DB_DATABASE}'
            MYSQL_USER: '${DB_USERNAME}'
            MYSQL_PASSWORD: '${DB_PASSWORD}'
            MYSQL_ALLOW_EMPTY_PASSWORD: 1
        volumes:
            - 'sailmysql:/var/lib/mysql'
        networks:
            - sail
        healthcheck:
          test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
          retries: 3
          timeout: 5s
    redis:
        image: 'redis:alpine'
        ports:
            - '${FORWARD_REDIS_PORT:-6379}:6379'
        volumes:
            - 'sailredis:/data'
        networks:
            - sail
        healthcheck:
          test: ["CMD", "redis-cli", "ping"]
          retries: 3
          timeout: 5s
networks:
    sail:
        driver: bridge
volumes:
    sailmysql:
        driver: local
    sailredis:
        driver: local

.env

APP_SERVICE="myapp.localhost"
WWWGROUP=1000
WWWUSER=1000
SAIL_XDEBUG_MODE=develop,debug
SAIL_XDEBUG_CONFIG="client_host=172.26.0.4"

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=sail
DB_PASSWORD=password

Any thoughts?

@driesvints
Copy link
Member

Try the latest Sail version (that has a fix) with a fresh install

@raimondas-nuz
Copy link
Author

I updated laravel/sail to version 1.13.1, reinstalled sail.
Result is the same.

Btw this is not a fresh install.

@raimondas-nuz
Copy link
Author

#314 (comment)

This thing helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants