Since the number of days has not yet been set for Docker for the first time, I will describe how to connect to Mysql in the terminal and play with it as a memorandum.
At the beginning,
docker ps
Then, check the container ID of Mysql.
name@mbp APP_NAME % docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2acfbade0963 app_name_web "rails s -p 3000 -b …" 2 days ago Up 2 days 0.0.0.0:3000->3000/tcp app_name
c71b0bf50f29 mysql:5.6.47 "docker-entrypoint.s…" 2 days ago Up 2 days 0.0.0.0:3306->3306/tcp app_name
It will come out like this, so this time I will copy "c71b0bf50f29".
next,
docker exec -it container ID mysql-u root -p
Connect to Mysql with.
This time, paste the "c71b0bf50f29" that you just copied.
The password is written in database.yml, so it's OK
If you want to play with the table from there
show databases;
Then copy the database and
use DB name you just copied
Check in the table
select *from table name;
Delete all in the table
DELETE FROM table name;
Recommended Posts