ストレージの永続化とかはしない
$ docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -e MYSQL_ROOT_USER=root -e MYSQL_DATABASE=todoapp -d mysql:5.7
あとはこんな感じでCLI経由で接続できる
$ mysql --host=127.0.0.1 --port=3306 -uroot -ppassword
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.35 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
なんでかわからんけど 127.0.0.1
じゃないとダメでlocalhostではつながらなかった。