0

I'm following this guide to use MySQL 8.0 in Docker (on macOS host), but I'm having some issues. I have no Docker experience other than this, so please be easy on me. I tried to debug as best I could. It seems the author of the guide has some outdated commands/syntax errors (not sure which), which I think I've fixed. However, when I try to run the following command, I keep getting the error below:

Command:

docker run --restart always --name mysql8.0 --network dev-network -v /Users/[my-name]/mysql/data/8.0:/var/lib/mysql -p 3306:3308 -d -e MYSQL_ROOT_PASSWORD=[my-password] mysql:8.0

( [my-name] and [my-password] are subbed out).

Error: "docker run" requires at least 1 argument.

I've checked docker run --help but can't get any further.

I've also found this question and this question, but those cases seem highly specific to the OPs' situation, so the answers didn't yield any successful results for me.

Any help or suggestions are appreciated.

MattR
  • 127
  • 2
  • 11
  • That image has its own perfect actual explanation on how to use it: https://hub.docker.com/_/mysql – zerkms Dec 15 '19 at 06:50
  • There might be some special characters in your password that are ending up confusing the parser? In which case putting single quotes around MYSQL_ROOT_PASSWORD=[my-password] might help. – Itamar Turner-Trauring Dec 15 '19 at 19:41

1 Answers1

1

The command you've pasted works fine. There is a possibility that the password you're entering has some special characters making the shell think of it as something else. (Or your volume next to -v flag has some special characters).

Just to test, try with a simple password like this:

docker run --restart always --name mysql8.0 --network dev-network -v /Users/[yourusername]/mysql/data/8.0:/var/lib/mysql -p 3306:3308 -d -e MYSQL_ROOT_PASSWORD=testpass 

mysql:8.0

Ahsan Nasir
  • 147
  • 1
  • 2
  • 7
  • Yep, sure enough that was it! Thank you! It looks like the password accepts alphanumeric characters only. – MattR Dec 16 '19 at 00:50