This project provides a simple way to set up and run MySQL using Docker and Docker Compose.
Ensure you have the following installed on your system:
git clone <https://github.com/bikundkumar/MySQL_Using_Docker_Compose.git>
cd mySQL-Docker
Modify the docker-compose.yml
file if needed to set your MySQL credentials (username, password, database name).
docker-compose up -d
This command will:
- Pull the required MySQL image (if not already available locally).
- Start a MySQL container in detached mode.
Check if the container is running using:
docker ps
To stop and remove the MySQL container, run:
docker-compose down
MySQL Workbench is a graphical tool for managing MySQL databases. Follow these steps to connect it to your MySQL Docker container:
-
Download and Install MySQL Workbench
- Visit the MySQL Workbench download page.
- Select your operating system and follow the installation instructions.
-
Open MySQL Workbench and Create a New Connection
- Click on the
+
icon to create a new connection. - Set the following parameters:
- Connection Name: Any descriptive name
- Connection Method: Standard TCP/IP
- Hostname:
localhost
(or the container’s IP address) - Port:
3306
(default MySQL port, change if needed) - Username:
root
(or any user set indocker-compose.yml
) - Password: Click
Store in Vault
and enter your MySQL password.
- Click
Test Connection
to verify the connection. - Click
OK
to save.
- Click on the
-
Start Managing Your Database
- Once connected, you can execute queries, manage databases, and visualize table structures using MySQL Workbench.