Running an Ad-Hoc MySQL Instance Locally with Docker

This note was created on 11 Dec, 2022 at 12:47.

For some reason I am incapable of committing the following to memory:

$ docker run --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -d mysql
$ docker exec -it mysql mysql -uroot -p

Adding --restart=unless-stopped to the docker run command will make the MySQL instance persist after a system restart or shutdown.