You can pull the MySQL image from the docker hub and run the container.So,you will be able to run MySQL on your machine without installing it.These are the main steps you need to follow for donaloding and running MySQL docker container on your local machine:-
1.pull image from docker hub
docker pull mysql/mysql-server:latest
2.This will download the docker image for MySQL.Now you need to check the password as you will need it when you will run the container.To get the password execute the following command:
docker logs mysql01
3.Now you need to start the container in interactive mode.You can execute the following command :-
docker exec -it mysql01 mysql -uroot -p
Now you will get the mysql prompt
mysql>
4.If you try to execute any command you will get the following error message:-
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
5.To resolve this error you need to change the password:-
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
Leave a Reply