This repository provides a simple template to run a PHP and MySQL application using Docker. Ideal for beginners or developers who need a fast, isolated, and consistent development environment.
- Isolation: Avoid PHP/MySQL version conflicts on your host system.
- Portability: Works across multiple operating systems without reconfiguration.
- Quick Deployment: Set up your development environment with a single command.
- Scalability: Easily extendable for production use.
- Download Docker Desktop:
π Download Docker - User Guide:
π Docker Documentation - Windows Users:
Make sure WSL (Windows Subsystem for Linux) is enabled.
This repository contains basic configuration for running a PHP and MySQL application using Docker.
-
Clone the repository:
git clone https://github.com/albertdveada/Tutorial-Docker-PHP-MySQL.git
-
Enter the project directory:
cd Tutorial-Docker-PHP-MySQL -
Start Docker Compose: Run Docker Compose to start the containers in the background.
docker-compose up -d
-
Access the Application in Your Browser:
Once the containers are up, you can access the services at:
-
π Open phpMyAdmin (localhost:8181)
π‘ phpMyAdmin Default Login:
- Server:
database - Username:
root - Password:
root_password
- Server:
Use the following commands to manage your Docker container lifecycle:
- Stop containers:
docker-compose stop
- Restart containers:
docker-compose start
- Remove containers, networks, volumes (for reset):
docker-compose down -v
-
MySQL 8.1+: Uses
caching_sha2_password, by default. no additional config needed. -
MySQL 8.0 or earlier: Use
mysql_native_password. Uncomment the following line indocker-compose.yml:command: --default-authentication-plugin=mysql_native_password
π¦ Tutorial-Docker-PHP-MySQL/
βββ docker-compose.yml
βββ index.php
βββ README.md
π Quick Overview:
docker-compose.yml: Defines all services (PHP, MySQL, phpMyAdmin).index.php: Example PHP app you can test in the browser.README.md: Full setup and usage guide for this project.
π‘ You can add folders like src/, config/, or public/ as your project grows.
Make sure your configuration matches the MySQL version youβre using. For more help, refer to the official Docker or MySQL documentation. Hope this tutorial helps! π
