Skip to content

Latest commit

 

History

History
87 lines (59 loc) · 1.38 KB

File metadata and controls

87 lines (59 loc) · 1.38 KB

MYSQL Docker Guide

Some basic commands to use mysql docker container

⏩ Running a sample

docker-compose up

To stop and remove all containers of the sample application run:

docker-compose down

To stop and remove all containers with Volume of the sample application run:

docker-compose down -v

✨ MYSQL Config

  • username - root
  • password - rajawat
  • port - 3306

🎓 MYSQL Commands

  1. Run the following command to open the mysql client terminal

Enter the password (Passw0rd.) when prompted.

user - rajawat/root password - rajawat/rajawat

docker exec -it mysql_container mysql -h localhost -u root -p

OR

Enter the password in command itself

user - rajawat/root password - rajawat/rajawat

docker exec -it mysql_container mysql -h localhost -u root -prajawat
  1. To See list of database:
show databases;
  1. Create database command ( Make sure you are logged in with root user)
create database lks;
  1. Change database context command ( Make sure you are logged in with root user)
use lks;
  1. Create database command ( Make sure you are logged in with root user)
drop database lks;
  1. To quit the database;
quit

Author

👤 RajawatBanna