Re-read about migrating in sail, I am pretty sure you precede with the word sail.
Edit:
Verify the host is correct for sail.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In the process of running migrations in my application, some tables gets migrated to the database but when it gets to one table, it throws an error that connection refused:
Migrating: 2020_01_05_160933_create_sessions_table
Migrated: 2020_01_05_160933_create_sessions_table (801.99ms)
Migrating: 2020_01_06_102937_create_devices_table
Migrated: 2020_01_06_102937_create_devices_table (447.02ms)
Migrating: 2020_01_16_110833_create_settings_table
Migrated: 2020_01_16_110833_create_settings_table (711.88ms)
Migrating: 2020_01_18_171110_create_matches_table
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused (SQL: create table `matches` (`id` bigint unsigned not null auto_increment primary key, `bet365_id` bigint not null, `bets_api_id` bigint null, `sport_id` bigint not null, `home_team_id` bigint not null, `away_team_id` bigint not null, `league_id` bigint not null, `cc` varchar(255) null, `starts_at` int not null, `time_status` tinyint not null, `last_bets_api_update` int not null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
I may not know why the connection is timing out on from one migration. KIndly help. My docker-compose.yml:
version: '3'
services:
laravel.test:
build:
context: ./docker/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
# - memsql
- pgsql
- redis
# - selenium
# selenium:
# image: 'selenium/standalone-chrome'
# volumes:
# - '/dev/shm:/dev/shm'
# networks:
# - sail
mysql:
image: 'mysql:8.0'
ports:
- '3305: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
healthcheck:
test: ["CMD", "mysqladmin", "ping"]
pgsql:
image: postgres:13
ports:
- '${FORWARD_DB_PORT:-5432}:5432'
environment:
PGPASSWORD: '${DB_PASSWORD:-secret}'
POSTGRES_DB: '${DB_DATABASE}'
POSTGRES_USER: '${DB_USERNAME}'
POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
volumes:
- 'sailpostgresql:/var/lib/postgresql/data'
networks:
- sail
healthcheck:
test: ["CMD", "pg_isready", "-q", "-d", "${DB_DATABASE}", "-U", "${DB_USERNAME}"]
# memsql:
# image: 'memsql/cluster-in-a-box'
# ports:
# - '3306:3306'
# - '8080:8080'
# environment:
# LICENSE_KEY: '${MEMSQL_LICENCE}'
# ROOT_PASSWORD: '${MEMSQL_ROOT_PWD}'
# volumes:
# - 'sailmemsql:/var/lib/memsql'
# networks:
# - sail
redis:
image: 'redis:alpine'
ports:
- '${FORWARD_REDIS_PORT:-6379}:6379'
volumes:
- 'sailredis:/data'
networks:
- sail
healthcheck:
test: ["CMD", "redis-cli", "ping"]
# memcached:
# image: 'memcached:alpine'
# ports:
# - '11211:11211'
# networks:
# - sail
mailhog:
image: 'mailhog/mailhog:latest'
ports:
- '${FORWARD_MAILHOG_PORT:-1025}:1025'
- '${FORWARD_MAILHOG_DASHBOARD_PORT:-8025}:8025'
networks:
- sail
networks:
sail:
driver: bridge
volumes:
sailmysql:
driver: local
sailmemsql:
driver: local
sailpostgresql:
driver: local
sailredis:
driver: local
My .env:
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=appdb
DB_USERNAME=username
DB_PASSWORD=password
@SimonAngatia so you are hardcoding the connection. Most likely that connection fails. Your env only shows one connection?
I assume the other migrations does not use this connection?
Schema::connection(config('database.feed_connection'))-
Please or to participate in this conversation.