Running and exposing default MySQL port:
docker run -e MYSQL_ROOT_PASSWORD=mypassword -p 3306:3306 -d mysql
mysql -u root -p
Running with a different exposed port on the host:
docker run -e MYSQL_ROOT_PASSWORD=mypassword -p 3307:3306 -d mysql
Connecting to server on different port : -P option, but also requires -h for host, otherwise seems to connect to whatever is running on 3306 by default:
mysql -h 127.0.0.1 -P 3307 -u root -p