How to Connect to docker Mysql through local PC
sudo docker run -e MYSQL_ROOT_HOST=your_ip -p 3309:3306 -e MYSQL_ROOT_PASSWORD=root mysql/mysql-server:latest
Now check the available docker container using the following command
sudo docker ps
once the container created a login to the container using the following command
sudo docker exec -it your_container_name /bin/bash
now connect the MySQL server
mysql -uroot -proot
Now once login to database create your database and enter the following command
ALTER USER ‘root’@’your_ip' IDENTIFIED WITH mysql_native_password BY ‘root’;
Bingo that’s all you have to do to connect to docker MySQL
Now exit from the docker and MySQL with your local pc.
How to Connect to docker Mysql through local PC
Reviewed by Prashant Suthar
on
August 27, 2019
Rating: 5
