Copying a sql file to docker container for import

docker
mysql
sql

Here's how I imported an sql to my Docker mysql database.

The problem: I had an SQL file and a docker container. How do you get your local SQL file on your PC to the docker container?

First find the docker container:

docker ps

This will list out a bunch of container ids. Find the one relating to mysql.

CONTAINER ID IMAGE ... [YourContainerId] mysql:5.7.29 ...CONTAINER ID IMAGE

Now copy the sql file using docker cp into our container

docker cp your.sql [YourContainerId]:/your.sql

Once complete, we need to login to our container and import to our mysql database.

docker exec -it [YourContainerId] bin/bash

Once we're logged in, we can now login to mysql.

mysql -u root -p

To see your databases, run show databases;

Select the database you're going to be importing to:

use your-database-name

Now import by running:

source your.sql

Let's chat about your next project

Whether you need a single contractor or a full team, I collaborate with a trusted network of designers and developers. Having worked on large-scale projects, I'm equally committed to supporting businesses of all sizes, locally in Surrey, London, and internationally.

See also...

CnCNet - Website & App Development

Comprehensive design and development of responsive web and desktop apps for CnCNet, enhancing user experience and accessibility.

AR Configurator for E-Bikes

Bespoke augmented reality web configurator for E-Bikes, offering full customization options, including color choices and feature configurations.

Stock Investment App

Real-time stock investment app for web and mobile, built with TypeScript, React, and WebSockets, delivering fast, responsive, and data-driven experiences.

KickTown Football - Website

Custom-built website and API's for KickTown Football, integrating a merchandise store, booking system, and seamless user experience.

Tempest Rising - Official Website

Website development for Slipgate Ironworks' Tempest Rising, crafted to deliver a sleek, immersive experience for fans and players.

Cosmetic Visualiser - Web App

React and TypeScript-powered web app for visualizing facial cosmetic treatments, offering a cutting-edge, interactive user experience.

C&C Community Website

Command & Conquer Community platform with improved SEO, a sleek interface, and content integrations like Twitch and Steam, creating a hub for fans and creators.

React Native Health App

Custom Android and iOS health app developed with React Native and TypeScript, tailored for a health-tech startup, ensuring cross-platform compatibility.

Oriental Garden Restaurant - Website Redesign

Website redesign featuring an online ordering system that boosts sales and enhances customer engagement with a modern, intuitive interface.

Brands I've had the privilege to contribute to...

Logo for Slipgate Studios
Logo for Evolve
Logo for Disney
Logo for Heathrow
Logo for BAE Systems
Logo for University of Surrey
Logo for Allergan
Logo for OKA
Logo for Ribena
Logo for NARS