Menu

1 / 2

Lesson 2: Adding MySQL to Laravel’s Apache Docker Setup

DEV Community: laravel·Muhammad Yasir Amin·2 days ago
#5Sh99Mzt
#devtolaravel#devto#dev#mysql#lesson
Reading 0:00
15s threshold

Laravel Docker Lessons · Lesson 2

In Lesson 1 , Laravel ran in a single PHP 8.2 + Apache container. Lesson 2 adds a separate MySQL 8.0 database service, enables Apache rewriting and tightens the virtual-host directory configuration. This walkthrough uses the committed files and separates configured infrastructure from Laravel's current database selection.

Use the correct lesson snapshot

This article documents the lesson-2 GitLab tag . The repository is public; you can inspect the tagged files without requesting access. Its commit is 189d6836d37046f066137c2211d2fa1a81c6ccda .

To inspect it without changing your current lesson checkout, create a separate Git worktree:

git fetch origin --tags git worktree add --detach ../docker-laravel-lesson-2 lesson-2 cd ../docker-laravel-lesson-2

Enter fullscreen mode

Exit fullscreen mode

Prepare the host dependencies with composer install , npm ci and npm run build .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.