docker에서 mysql 실행하기



docker volume create mysqldb


docker pull mysql
docker image history mysql (##포트 확인)


docker run –name yslee-mysql -p 3306:3306 -v mysqldb:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mysql


docker exec -it yslee-mysql bash
mysql -u root -p
show databases;
use mysql;
show tables;
create table tbl1 (id int);
show tables;
insert into tbl1 values (100);
insert into tbl1 values (200);
select * from tbl1;

select database();
select version();
select now();
exit
exit


docker volume inspect mysqldb;
cd /var/lib/docker/volumes/mysqldb/_data
ls -l
ls -l mysql/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s