Run and connect to MySQL in one step using docker run

you can run and connect to mysql container in one line command this way:

docker run --name=mk-mysql -p3306:3306 -e MYSQL_ROOT_PASSWORD=my-secret-pw -it mysql/mysql-server:8.0 mysqlsh

I think that could be available for older versions of MySQL but I am unable to do such one liner. (No compose, sh or similar workarounds, just docker run command)

Any hint would be much appreciated

that is a very confusing command line. you’re trying to run mysqlsh from the command line within the container itself but it looks like it’s constructed wrong.

could be all kinds of reasons. it’s missing the direct path to mysqlsh, the image name should be at the end of the command, etc.