docker pull mariadb
docker container run -d -p 3309:3306 -e MYSQL_ROOT_PASSWORD=1234 --name testdb mariadb
docker exec -it testdb bash
mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.Commands end with ; or \g.
Your MariaDB connection id is 3 Server version: 10.5.8-MariaDB-1:10.5.8+maria~focal mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database testdb;
Query OK, 1 row affected (0.001 sec
pull : 이미지를 땡겨오는 명령어
container run : 컨테이너 실행
-d : 데몬, -p : 포트 세팅 , -name : 컨테이너 별명 붙이기
exec -it [name] bash : 컨테이너 안으로 들어가기