Sign inSign up

andreadipietro/mysql-shell

By andreadipietro

•Updated over 5 years ago

MySQL Shell images, use it from container's cli or extend it to build your service image.

Image
0

68

andreadipietro/mysql-shell repository overview

⁠A MySQL-Shell (mysqlsh) image.

⁠Examples Usages

⁠open MySQL-Shell

Deploy a container and open mysqlsh, remove the container when stopped:

docker run --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c mysqlsh
⁠open and connect

Deploy a container and connect to a databases, remove the container when stopped:

docker run --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c  "mysqlsh user@host:port/schema"
⁠connect and execute a query

Deploy a container and connect to a database execute a query and remove the container:

docker run --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c  "echo \"query\" | mysqlsh --sql --uri=user@host:port/schema"
⁠export as JSON the result of a query into a host file

Deploy a container setting the WORKING DIRECTORY (-w), binding it with a host location (-v), and after the export is done remove the container:

docker run -v ${PWD}/json:/host_dir  -w /host_dir --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c  "echo \"query\" | mysqlsh --sql --result-format=json/array --uri=user@host:port/schema > export.json"
⁠execute a SQL file from host

Deploy a container setting the WORKING DIRECTORY (-w) pointing to the bonded volume (-v) where the host contains the SQL file (mysqls.sql). After the execution removes the container:

docker run -v ${PWD}:/host_sqls  -w /host_sqls --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c  "echo \"$(cat mysqls.sql)\" | mysqlsh --sql --uri=user@host:port/schema"
⁠execute an host SHELL script powered by MySQL-Shell

Deploy a container setting the WORKING DIRECTORY (-w) pointing to the bonded volume (-v) where the host contains the script file (myscript.sh). After the execution removes the container:

 docker run -v ${PWD}:/host_scripts  -w /host_scripts --rm -it andreadipietro/mysql-shell:8.0.25_debian-buster-slim bash -c "sh myscript.sh"

...

These are only some examples but a lot more can be done.

Tag summary

Content type

Image

Digest

Size

67.1 MB

Last updated

over 5 years ago

docker pull andreadipietro/mysql-shell:8.0.25_debian-buster-slim