Articles → DOCKER → Create A Docker Container With Mysql Image And Execute Database Commands

Create A Docker Container With Mysql Image And Execute Database Commands






Create A Container With Mysql Image




docker run --name my-mysql-container -e MYSQL_ROOT_PASSWORD=test -d -p 3306:3306 mysql




  1. my-mysql-container is the container name
  2. test is the mysql password

Execute Commands For Mysql




docker exec -it my-mysql-container sh




mysql -u root -p




Picture showing the execution of mysql -u root -p command in shell
Click to Enlarge



Picture showing the execution of show databases command
Click to Enlarge




Posted By  -  Karan Gupta
 
Posted On  -  Thursday, May 25, 2023

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250