Run MySQL in Docker: Quick Guide
To run MySQL in Docker, you first need to install Docker and start the Docker engine. Then you can follow these steps to run MySQL in Docker:
- Pulling the MySQL image from the repository.
docker pull mysql
- Run the MySQL container.
docker run --name=mysql-container -e MYSQL_ROOT_PASSWORD=password -d mysql
This will create a MySQL container named mysql-container and set the root user’s password to “password”.
- Connect to the MySQL container:
docker exec -it mysql-container mysql -uroot -ppassword
This will connect to the running MySQL container and login using the password “password” for the root user.
You can now run MySQL in Docker and manage the database by connecting to the container.