How to run MYSQL in Docker container?

  • Use port mapping
  • Environment Variables
  • Persistance Storage

https://hub.docker.com/r/mysql/mysql-server/

Giving the container name: ian-mysql
-e for environment variable: MYSQL_ALLOW_EMPTY_PASSWORD = yes 
-v volume: Map the directory I am in /Users/ian/workspace/tmp to /var/lib/mysql (The directory mysql is going to be writing data)
-p map the localhost 3306 to the container 3306
-d as a daemon process in the background
docker run --name ian-mysql -e MYSQL_ALLOW_EMPTY_PASSWORD = yes 
-v /Users/ian/workspace/tmp:/var/lib/mysql 
-p 3306: 3306 -d mysql

docker ps

docker ps -a

docker logs

history | grep mysql
!575

results matching ""

    No results matching ""