docker-mysql
⛔ Deprecated
Use docker-mysql-init instead.
Overview
This Dockerfile is a wrapper over the MySQL Command-Line Tool.
Contents
Legend
- 🤔 - A "thinker" icon means that a little extra thinking may be required. Perhaps you'll need to make some choices. Perhaps it's an optional step.
- ✏️ - A "pencil" icon means that the instructions may need modification before performing.
⚠️ - A "warning" icon means that something tricky is happening, so pay attention.
Create docker container
-
Build docker container. Example:
sudo docker build \ --tag senzing/mysql \ https://github.com/senzing/docker-mysql.git#main
Docker network
🤔 Optional: Use if docker container is part of a docker network.
-
List docker networks. Example:
sudo docker network ls
-
✏️ Specify docker network. Choose value from NAME column of
docker network ls
. Example:export SENZING_NETWORK=*nameofthe_network*
-
Construct parameter for
docker run
. Example:export SENZING_NETWORK_PARAMETER="--net ${SENZING_NETWORK}"
Run Docker container
-
✏️ Identify the file of SQL to be run. Example: If the actual file pathname is
/path/to/mysqlfile.sql
export MYSQL_DIR=/path/to export MYSQL_FILE=mysqlfile.sql
-
✏️ Identify the database username and password. Example:
export MYSQL_USERNAME=root export MYSQL_PASSWORD=root
-
✏️ Identify the database that is the target of the SQL statements. Example:
export MYSQL_DATABASE=mydatabase
-
✏️ Identify the host running mySQL servers. Example:
sudo docker ps # Choose value from NAMES column of docker ps export MYSQL_HOST=docker-container-name
-
Create the docker container. Note: parameters after senzing/mysql are mysql CLI options.
sudo docker run -it \ --volume ${MYSQL_DIR}:/sql \ ${SENZING_NETWORK_PARAMETER} \ senzing/mysql \ --user=${MYSQL_USERNAME} \ --password=${MYSQL_PASSWORD} \ --host=${MYSQL_HOST} \ --database=${MYSQL_DATABASE} \ --execute="source /sql/${MYSQL_FILE}"