Try It edit

Online Free edit

  1. Use Play with Docker. Create an account and/or log in.
  2. Start an interactive session and add a new instance.
  3. In the terminal window, enter the following commands:
    • docker run --name mysql-server -e MYSQL_ROOT_PASSWORD=secret -d mysql
  4. To connect to the mysql-server:
    • docker exec -it mysql-server bash
    • mysql -u root -p
      Enter secret for the root password when prompted.

On Your Own System edit

  1. Install Docker Desktop or the Docker Engine.
  2. In a terminal window, enter the following commands:
    • docker run --name mysql-server -e MYSQL_ROOT_PASSWORD=secret -d mysql
  3. To connect to the mysql-server:
    • docker exec -it mysql-server bash
    • mysql -u root -p
      Enter secret for the root password when prompted.

See Also edit