Read dump file with Docker MySQL

Purpose

--Summary of how to read dump file into MySQL of Docker

Implementation environment

--Hardware environment

item information
OS macOS Catalina(10.15.5)
hardware MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)
Processor 2 GHz quad core Intel Core i5
memory 32 GB 3733 MHz LPDDR4
Graphics Intel Iris Plus Graphics 1536 MB

--Software environment

item information Remarks
dump file creation MySQL version 8.0.19 for osx10.13 on x86_64 Introduced by this method using Homebrew →Install MySQL with Mac Homebrew
dump file read MySQL version 8.0.19 for osx10.13 on x86_64 Introduced by this method using Homebrew →Install MySQL with Mac Homebrew

Prerequisites

--The dump file is prepared locally on your PC. --The MySQL container is running.

Prerequisite information

--Read the dump file Docker's MySQL is the environment prepared by your senior. -Laravel course starting with Docker --Laravel edition

Overview

  1. Move dump file
  2. Read
  3. Confirmation

Details

  1. Move dump file

  2. Use the $ cd command to move to the directory where the dump file is located.

  3. Execute the following command to copy the dump file into the docker container.

    ```terminal
    $docker cp dump file name container name:/Copy destination dump file name
    ```
    
  4. For example, if you want to copy my_dump.sql directly under the local ~ / Downloads directly under the root directory of the container name" docker_mysql_1 ", it will be as follows.

    ```terminal
    $ docker cp ~/Downloads/my_dump.sql docker_mysql_1:/my_dump.sql
    ```
    
  5. Read

  6. Execute the following command to enter the MySQL container.

    ```terminal
    $ docker exec -it container name bash
    ```
    
  7. Execute the following command to read the dump file.

    ```terminal
    $ mysql -u MySQL username-password associated with pMySQL user name DB name to read dump file<dump file name
    ```
    
  8. Confirmation

  9. Execute the following command in the MySQL container to log in to MySQL.

    ```terminal
    $ mysql -u root -p
    ```
    
  10. Execute the following SQL and check that the contents of the dump file are read normally and the tables etc. exist.

    ```sql
    

DB name that read use dump; show tables; ```

Recommended Posts

Read dump file with Docker MySQL
[Docker] Connection with MySQL
Rails + MySQL environment construction with Docker
[Environment construction with Docker] Rails 6 & MySQL 8
mysql doesn't start up with docker.
Update MySQL from 5.7 to 8.0 with Docker
Create Rails 6 + MySQL environment with Docker compose
Deploy to heroku with Docker (Rails 6, MySQL)
Edit Mysql with commands in Docker environment
Create a MySQL environment with Docker from 0-> 1
Laravel + MySQL + phpMyadmin environment construction with Docker
Allow image posting with [Docker + WordPress + MySQL]
Read xlsx file in Java with Selenium
Implement simple CRUD with Go + MySQL + Docker
Read environment variables with ruby ​​file [Super beginner]
React + Django + Nginx + MySQL environment construction with Docker
Read Java Property file
[Spring] Read a message from a YAML file with MessageSource
Rails deploy with Docker
Run Pico with docker
Explode Docker with WSL2
Use Puphpeteer with Docker
Operate Emby with Docker
Try WildFly with Docker
Use ngrok with Docker
Run Payara with Docker
Php settings with Docker
[Rails] Development with MySQL
Getting Started with Docker
Build Rails (API) x MySQL x Nuxt.js environment with Docker
Disposable PHP with Docker
Install Composer with Docker
I tried to make an introduction to PHP + MySQL with Docker
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]
How to use mysql with M1 mac Docker preview version
docker-compose.yml when you want to keep mysql running with docker
Measures for permissions when building MySQL with Docker on WSL2
csv file output with opencsv
Use GDAL with Python with Docker
[Template] MySQL connection with Java
Deploy with EC2 / Docker / Laravel
Run TAO Core with Docker
Manually set docker file sharing
Docker management with VS Code
Set up GitLab with docker
File upload with Spring Boot
Run Rails whenever with docker
Get started with DynamoDB with docker
Docker autostart settings with wsl2
Connect to MySQL 8 with Java
[Docker] Rails 5.2 environment construction with docker
Spring Boot starting with Docker
Build docker environment with WSL
Version control CocoaPods with Docker
Web application built with docker (1)
[Java] [Android] Read ini file
I tried BIND with Docker
React environment construction with Docker
Build DynamoDB local with Docker