This repository contains a Docker Compose configuration to set up MySQL and phpMyAdmin containers. It allows you to easily manage your MySQL database using phpMyAdmin.
- Docker: Make sure you have Docker installed on your system. You can download and install Docker from here.
-
Clone this repository to your local machine.
git clone https://github.com/3l4un1ck/mysql-phpmyadmin-docker-compose.git
-
Navigate into the cloned directory.
cd mysql-phpmyadmin-docker-compose -
Modify the
docker-compose.ymlfile to customize MySQL root password, database name, username, and password. Replaceyour_root_password,your_database_name,your_username, andyour_passwordwith your desired credentials. -
Execute the following command to start the containers.
docker-compose up -d
This command will start both MySQL and phpMyAdmin containers in detached mode, meaning they will run in the background.
-
Access phpMyAdmin in your web browser by navigating to
http://localhost:8080. You can log in using the MySQL root credentials you provided. -
After you're done, you can stop and remove the containers by executing:
docker-compose down
This will stop and remove both containers.
-
You can customize the MySQL root password, database name, username, and password by modifying the environment variables in the
docker-compose.ymlfile. -
If you want to change the ports or any other configurations, you can modify the
docker-compose.ymlfile accordingly.
-
The MySQL data volume is mounted at
./mysql_dataon the host machine. This ensures that MySQL data is persisted even if the container is stopped or removed. -
Ensure that the necessary ports (3306 for MySQL and 8080 for phpMyAdmin) are not being used by other applications on your system before running the containers.