This is by design: you’re spinning up a brand new MySQL server with nothing in it. We configured the server so the root account doesn’t have a password press ENTER when prompted.ĭon’t use 127.0.0.1 for $LOCAL_IP, it only works with your real IP address. $ docker run -it -v $PWD:/data -w /data -rm mysql mysql -h $LOCAL_IP -u root -p # docker run - runs an image # -i - keeps STDIN open # -t - allocates a pseudo-TTY # -v $PWD:/data - binds $PWD to /data inside the container # -w /data - changes the PWD of the container to /data # -rm - cleans up container after it exits # mysql - the name of the image to run # mysql -h $LOCAL_IP -u root -p - the command to run inside the container This is where you’ll run the client andĬonnect to the MySQL server. Note: ctrl-c doesn’t kill the server – but ctrl-\ does. Convenience is often the opposite of security. This is meant to be run locally and to be The use of -e MYSQL_ALLOW_EMPTY_PASSWORD=yes might raise an eyebrow, but # docker run - runs an image # -e MYSQL_ALLOW_EMPTY_PASSWORD=yes - sets an environment variable # -p 3306:3306 - exposes container port 3306 as local port 3306 # -rm - cleans up container after it exits # mysql - the name of the image to run $ docker run -e MYSQL_ALLOW_EMPTY_PASSWORD = yes -p 3306:3306 -rm mysql This isn’t a Docker tutorial you know where to find one if needed :-) How to Run the Server Or, if you don’t want latest, check the available versions. Pull down the mysql image: $ docker pull mysql You get the menu bar whale icon and the docker command will be available on With Docker, I can pull down the official MySQL imageĪnd run both server and client from it.
0 Comments
Leave a Reply. |