Hermetic MySQL in the modern world
So you're looking to run a MySQL docker instance without any environmental dependencies? Here's how to do that:
$ docker run --name mysql-test -e MYSQL_ALLOW_EMPTY_PASSWORD=true -e MYSQL_DATABASE=testingdb -e MYSQL_USER=scott -e MYSQL_PASSWORD=tiger -p 3306:3306 mysql/mysql-server:latest
Documentation on the various environment variables are located here:
To connect to your MySQL instance without depending on my.cnf:
$ mysql --no-defaults --host 127.0.0.1 --port 3306 --user scott --password --protocol tcp testingdb
That's it. You have a running instance of mysql from a docker image and you're connecting to it with a generic mysql command line client. Have fun.