title: Laravel Sail rebuild default database
body: <p>According to docs:</p>
  <blockquote>
  <p>Also, when the MySQL container is starting, it will ensure a database exists whose name matches the value of your DB_DATABASE environment variable.</p>
  </blockquote>
  <p>My <code>.env</code> file looks like this.</p>
  <pre><code>DB_CONNECTION=mysql
  DB_HOST=mysql
  DB_PORT=3306
  DB_DATABASE=test
  DB_USERNAME=root
  DB_PASSWORD=
  </code></pre>
  <p>Yet when I try to run the migrations via <code>sail artisan migrate</code>, I get back this error:
  <code>SQLSTATE[HY000] [1049] Unknown database 'test' (SQL: select * from information_schema.tables where table_schema = test and table_name = migrations and table_type = 'BASE TABLE')</code></p>
  <p>What I've tried:</p>
  <ul>
  <li>Removing the docker container and images all together.</li>
  <li>Running <code>sail build --no-cache</code> (to try and rebuild everything altogether)</li>
  <li>When running <code>sail shell</code>, I went into MySQL and showed all databases. I could see the default laravel database there.</li>
  </ul>
  <p>How do you tell sail to create the correct <code>DB_DATABASE</code>?</p>
  <p>My <code>docker-compose.yml</code>:</p>
  <pre><code># For more information: https://laravel.com/docs/sail
  version: '3'
  services:
      laravel.test:
          build:
              context: ./vendor/laravel/sail/runtimes/8.0
              dockerfile: Dockerfile
              args:
                  WWWGROUP: '${WWWGROUP}'
          image: sail-8.0/app
          ports:
              - '${APP_PORT:-80}:80'
          environment:
              WWWUSER: '${WWWUSER}'
              LARAVEL_SAIL: 1
          volumes:
              - '.:/var/www/html'
          networks:
              - sail
          depends_on:
              - mysql
              - redis
      mysql:
          image: 'mysql:8.0'
          ports:
              - '${FORWARD_DB_PORT:-3306}:3306'
          environment:
              MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
              MYSQL_DATABASE: '${DB_DATABASE}'
              MYSQL_USER: '${DB_USERNAME}'
              MYSQL_PASSWORD: '${DB_PASSWORD}'
              MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
          volumes:
              - 'sailmysql:/var/lib/mysql'
          networks:
              - sail
      redis:
          image: 'redis:alpine'
          ports:
              - '${FORWARD_REDIS_PORT:-6379}:6379'
          volumes:
              - 'sailredis:/data'
          networks:
              - sail
      mailhog:
          image: 'mailhog/mailhog:latest'
          ports:
              - 1025:1025
              - 8025:8025
          networks:
              - sail
  networks:
      sail:
          driver: bridge
  volumes:
      sailmysql:
          driver: local
      sailredis:
          driver: local
  </code></pre>