Setup a Docker Container

Enable Basic Authentication

docker build --tag mysql-basic-auth ./docker/

Setup

docker volume create mysql_data

docker run -it --name mysql \
  -e MYSQL_RANDOM_ROOT_PASSWORD=true \
  -e MYSQL_ONETIME_PASSWORD=true \
  --mount src=mysql_data,dst=/var/lib/mysql/ \
  mysql-basic-auth

Once up and running, detach with ^P, ^Q.

Insepct the logs, and reset the root password:

docker logs mysql 2>&1 | grep 'GENERATED ROOT PASSWORD:'
docker exec -it mysql mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY '${NEW_PASS}';