[RUBY] Edit Mysql with commands in Docker environment

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.

[email protected] 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 >3000/tcp   app_name
c71b0bf50f29        mysql:5.6.47        "docker-entrypoint.s…"   2 days ago          Up 2 days >3306/tcp   app_name

It will come out like this, so this time I will copy "c71b0bf50f29".


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

Edit Mysql with commands in Docker environment
Rails + MySQL environment construction with Docker
[Environment construction with Docker] Rails 6 & MySQL 8
Check MySQL logs in Docker environment
Alert slack with alert manager in Docker environment
Create Rails 6 + MySQL environment with Docker compose
Create a MySQL environment with Docker from 0-> 1
Laravel + MySQL + phpMyadmin environment construction with Docker
[Docker] Connection with MySQL
Self-hosting with Docker of AuteMuteUs in Windows environment
Rails6 [API mode] + MySQL5.7 environment construction with Docker
React + Django + Nginx + MySQL environment construction with Docker
How to execute with commands of normal development language in Docker development environment
Pytorch execution environment with Docker
MySQL 5.7 (Docker) environment construction memo
[Note] Build a Python3 environment with Docker in EC2
[Docker] Rails 5.2 environment construction with docker
Build docker environment with WSL
Build Rails (API) x MySQL x Nuxt.js environment with Docker
React environment construction with Docker
Database environment construction with Docker in Spring boot (IntellJ)
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Express ~
Easy environment construction of MySQL and Redis with Docker and Alfred
Rails application development environment construction with Docker [Docker, Rails, Puma, Nginx, MySQL]
Create a Vue3 environment with Docker!
Node.js environment construction with Docker Compose
Build a Node.js environment with Docker
Environment construction with Docker for beginners
Build PlantUML environment with VSCode + Docker
Build environment with vue.js + rails + docker
Read dump file with Docker MySQL
Build Rails environment with Docker Compose
Create SolrCloud verification environment with Docker
Install laravel/Dusk in docker environment (laravel6)
Create Laravel environment with Docker (docker-compose)
mysql doesn't start up with docker.
Commands often used in MySQL operations
Update MySQL from 5.7 to 8.0 with Docker
Build docker + laravel environment with laradock
Build apache7.4 + mysql8 environment with Docker (with initial data) (your own memo)
Procedure for building a Rails application development environment with Docker [Rails, MySQL, Docker]
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ MySQL edition ~
How to build Rails + Vue + MySQL environment with Docker [2020/09 latest version]
Build a development environment for Django + MySQL + nginx with Docker Compose
"Rails 6 x MySQL 8" Docker environment construction procedure for sharing with teams
A story stuck with log output in Docker + Play framework environment
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Sequelize ~
SQL statement learning ~ Environment construction ~ Docker + MySQL
GPU environment construction with Docker [October 2020 version]
[Docker] Use environment variables in Nginx conf
Rails environment construction with Docker (personal apocalypse)
Building Rails 6 and PostgreSQL environment with Docker
Laravel development environment construction with Docker (Mac)
Build a PureScript development environment with Docker
Deploy to heroku with Docker (Rails 6, MySQL)
Use docker in proxy environment on ubuntu 20.04.1
Scraping with puppeteer in Nuxt on Docker.
Environment construction with Docker (Ubuntu20.04) + Laravel + nginx
Create Spring Boot-gradle-mysql development environment with Docker
MySQL container does not start in Docker
[Docker] Development environment construction Rails6 / Ruby2.7 / MySQL8